Search⌘ K
AI Features

Using Astro with Your Favourite Framework

Explore how to integrate popular frameworks such as React, Svelte, and SolidJS into your Astro projects. Understand the steps for adding these integrations, configuring Astro, and enabling client directives to bring interactivity to your components while maintaining performance.

While this course focuses on using Astro exclusively, it’s important to understand how to integrate a third-party framework with Astro. In this lesson, we’ll take a quick look at adding React as an integration and using it within an Astro project.

Add React as an integration

The first step is to add React as an integration. To do this, run the application below, then execute the following command inside the terminal to install React as an integration:

YAML
npx astro add react
export const Toggle = () => {
    return <h1>Hello from React 👋</h1>
}
Astro using React

Once we execute the command, Astro will prompt us to install the required dependencies. Press “Y” to accept the ...