20 lines
897 B
Markdown
20 lines
897 B
Markdown
|
# Prefresh-core
|
||
|
|
||
|
[](https://www.npmjs.com/package/@prefresh/core)
|
||
|
|
||
|
We are still fleshing out the details on how to go about this approach best for [Preact](https://github.com/preactjs/preact), we'd
|
||
|
love to give you the best reloading experience possible.
|
||
|
|
||
|
Note that now the refreshing component will dispose of its `hookState` to reload in case of added hook, ... this to ensure consistency.
|
||
|
|
||
|
## How to use
|
||
|
|
||
|
This plugin will set up a series of hooks onto the webpack instance, so the first thing
|
||
|
to do is ensure that this package is part of your entries.
|
||
|
|
||
|
This will add a method on the window `window.__PREFRESH__.replaceComponent`, this function
|
||
|
expects two arguments. The first being the old `class/function` and the second the new one.
|
||
|
|
||
|
This will go over all vnodes it knows for the `oldType` and rerender them according to the
|
||
|
`NewType`.
|