0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00
astro/examples/framework-react
github-actions[bot] 239c7b1668
Version Packages (#887)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-07-27 16:10:47 -04:00
..
src
.gitignore
.npmrc
astro.config.mjs
package.json Version Packages (#887) 2021-07-27 16:10:47 -04:00
README.md

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:

  1. Install @astrojs/renderer-react

    npm i @astrojs/renderer-react
    
  2. Add "@astrojs/renderer-react" to your renderers in astro.config.mjs.

    export default {
      renderers: [
        "@astrojs/renderer-react",
        // optionally, others...
      ]
    }
    

Usage

Write your React components as .jsx or .tsx files in your project.