.. | ||
src | ||
.gitignore | ||
.npmrc | ||
astro.config.mjs | ||
package.json | ||
README.md | ||
tsconfig.json |
Using React with Astro
This example showcases Astro's built-in support for React.
Installation
Automatic
Bootstrap your Astro project with this template!
npm init astro -- --template framework-react
Manual
To use React components in your Astro project:
-
Install
@astrojs/renderer-react
npm i @astrojs/renderer-react
-
Add
"@astrojs/renderer-react"
to yourrenderers
inastro.config.mjs
.export default { renderers: [ "@astrojs/renderer-react", // optionally, others... ] }
Usage
Write your React components as .jsx
or .tsx
files in your project.