Inspired by Freactal, but better 😉
Differences with freactal:
propsare available both in effects and computed values
- computed values are available in the
finalizeeffect is triggered on unmount (symmetry with
- easy async effects
- update state by default: no need for
- no helper functions (not necessary)
- no hydrate support
- no middlewares support
Installation of the npm package:
> npm install --save @julien-f/freactal
const wrapComponentWithState =const Parent =const Child =
/** @jsx Preact.h */const injectState provideState =// The rest is the same.
Effects can access the state through
this, for reading and writing, which is
very convenient when the state needs to be updated multiple times.
This example comes from the excellent Freactal documentation.
givenName: 'Walter'familyName: 'Harriman'effects:givenName: valuefamilyName: valuecomputed:` ``Hi, , and welcome!`
# Install dependencies > yarn # Run the tests > yarn test # Continuously compile > yarn dev # Continuously run the tests > yarn dev-test # Build for production > yarn build
Contributions are very welcomed, either on the documentation or on the code.
- report any issue you've encountered;
- fork and create a pull request.
ISC © Julien Fontanet