0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/examples/framework-preact
github-actions[bot] 2847ff5382
Version Packages (#1344)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-09-09 10:57:16 -07:00
..
public make example favicons prefer non-dark mode 2021-08-17 22:33:42 -07:00
src cleanup example favicons 2021-08-16 14:34:08 -07: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 Add zod schema validation (#1198) 2021-08-23 14:07:03 -07:00
package.json Version Packages (#1344) 2021-09-09 10:57:16 -07:00
README.md Expose JSX compilation to renderers (#588) 2021-07-21 18:10:03 -05:00
tsconfig.json [ci] yarn format 2021-08-13 23:32:55 +00: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.