astro/examples/framework-preact
github-actions[bot] 8f17217e02
Version Packages (next) (#796)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-07-21 18:12:11 -05:00
..
src Update docs in compiler messages (#710) 2021-07-16 07:01:31 -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 (next) (#796) 2021-07-21 18:12:11 -05:00
README.md Expose JSX compilation to renderers (#588) 2021-07-21 18:10:03 -05:00

Using Preact with Astro

This example showcases Astro's built-in support for Preact.

Installation

Automatic

Bootstrap your Astro project with this template!

npm init astro -- --template framework-preact

Manual

To use Preact components in your Astro project:

  1. Install @astrojs/renderer-preact

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

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

Usage

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