razzle-examples-preact

0.8.1 • Public • Published

Razzle Preact Example

How to use

Download the example or clone the whole project:

curl https://codeload.github.com/jaredpalmer/razzle/tar.gz/master | tar -xz --strip=2 razzle-master/examples/with-preact
cd with-preact

Install it and run:

yarn install
yarn start

Idea behind the example

This shows how to setup Preact with Razzle.

Here is a list of changes from Razzle's base template:

  1. Install babel-plugin-transform-react-jsx as a devDependency.
  2. Extend Razzle's babel config with a custom .babelrc
  3. Install preact and preact-render-to-string
  4. Remove react, react-dom, react-router-dom entirely
  5. Update server.js to use preact-render-to-string's render function. Also remove the <div id="root"> element from our html template since Preact can render to the body.

Readme

Keywords

none

Package Sidebar

Install

npm i razzle-examples-preact

Weekly Downloads

16

Version

0.8.1

License

MIT

Last publish

Collaborators

  • jaredpalmer