A React-Static plugin that adds support for preact
A React-Static plugin that adds support for preact
In an existing react-static site run:
``bash`
$ yarn add react-static-plugin-preact
Then add the plugin to your static.config.js:
`javascript`
export default {
plugins: ["react-static-plugin-preact"]
};
As final step, depending on the template you started with, you might need to remove the React Hot Reload component from index.js. Change:
``
const render = Comp => {
renderMethod(
target
)
}
to:
``
const render = Comp => {
renderMethod(
target
)
}
To preserve component state when using prefresh, it is neccesary to name the components you're exporting. Instead of Want to refresh Want to refresh
``
export default () => {
return
}`
You'll have to write your components like this:
const Refresh = () => {
return
}
export default Refresh;
`
or Want to refresh
```
export default function Refresh () {
return
}