Package Exports
- @prefresh/core
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@prefresh/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Prefresh-core
Experimental package
We are still fleshing out the details on how to go about this approach best for 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.
Uncertainties
- component altering lifecycles
- error recovery
- class components
- functional components
- hook swapping
- avoid triggering effects for added dependencies
- transition better from Functional --> class and other way around
- provide fallback if no hot modules/no preact modules (window.location.reload())
- custom hooks