---
const { user } = Astro.props;
---
<article class="user">
<h1>{ name }</h1>
<p>Stuff about the user here...</p>
</article>
User.astro
Component script section
Template section
---
import User from '../components/User.jsx';
---
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<User name="Matthew" />
</body>
</html>
index.astro
import React from 'react';
export default function({ name }) {
return (
<article class="user">
<h1>{ name }</h1>
<p>Stuff about the user here...</p>
</article>
);
}
User.jsx
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<article class="user">
<h1>Matthew</h1>
<p>Stuff about the user here...</p>
</article>
</body>
</html>
index.html
---
import User from '../components/User.jsx';
---
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<User client:load name="Matthew" />
</body>
</html>
index.astro
---
import User from '../components/User.jsx';
---
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<User client:idle name="Matthew" />
</body>
</html>
index.astro
---
import User from '../components/User.jsx';
---
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<User client:visible name="Matthew" />
</body>
</html>
index.astro
---
import User from '../components/User.jsx';
---
<html lang="en">
<head>
<title>User page</title>
</head>
<body>
<h1>Users</h1>
<User client:media="(max-width: 600px)" name="Matthew" />
</body>
</html>
index.astro
example here
---
let color = 'blue';
---
<style define:vars={{ color }}>
.user {
color: var(--color);
}
</style>
<time id="today"></time>
<script>
import {format} from 'date-fns';
const nowFormatted = format(new Date(), 'MMMM dd, yyyy -- H:mm:ss.SSS');
document.querySelector('#time').textContent = nowFormatted;
</script>
We are really close! But a few more things...