This example showcases Astro's built-in support for Preact.
Bootstrap your Astro project with this template!
npm init astro -- --template framework-preact
To use Preact components in your Astro project:
-
Install
@astrojs/renderer-preact
npm i @astrojs/renderer-preact
-
Add
"@astrojs/renderer-preact"
to yourrenderers
inastro.config.mjs
.export default { renderers: [ "@astrojs/renderer-preact", // optionally, others... ] }
Write your Preact components as .jsx
or .tsx
files in your project.