0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/examples/framework-react
github-actions[bot] b4f7888be3
Version Packages (#912)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-07-28 14:37:29 -04:00
..
src Added undefined check for spread props (#832) 2021-07-27 08:56:46 -04:00
.gitignore Restructure examples (#568) 2021-06-28 10:46:10 -05:00
.npmrc Restructure examples (#568) 2021-06-28 10:46:10 -05:00
astro.config.mjs [ci] yarn format 2021-07-20 04:07:49 +00:00
package.json Version Packages (#912) 2021-07-28 14:37:29 -04:00
README.md Expose JSX compilation to renderers (#588) 2021-07-21 18:10:03 -05:00

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.