Integrations: Use React component in Astro - astro - react

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


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 client side, unless you add client:load to them:

<Test client:load />

Lessons in this unit:

0: Introduction
1: Client-side routing and view transitions
2: View Transitions and Dark Mode
3: Adding React Framer Motion animations to an Astro site - react - astro
4: ▶︎ Use React component in Astro - astro - react
5: Passing Astro components to React components
6: htmx and Astro View Transitions
7: htmx forms and Astro View Transitions