Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
First run npx astro add react
Then create components/Test.jsx
export default function Test(props) {
return <p>test</p>
}
Now in a .astro component import it:
import Test from '../components/Test'
and in its “JSX” include it:
<Test />
Done!
One gotcha: React components are rendered server-side, not on the client side, unless you add client:load to them:
<Test client:load />