flooks
Auto optimized React Hooks state manager. Tiny, simple, smooth.
Features
- Gorgeous auto optimized re-render
- Intelligent loading state
- Interconnected modules
- Extremely simple API
Install
Usage
* Intelligent loading state - if someFn
is async, someFn.loading
is its loading state. If someFn.loading
is not used, no extra re-render.
Demo
Gorgeous re-render optimization
Through proxy
, flooks realizes a gorgeous auto optimization, re-render completely on demand, when React is truly "react".
Only actually used data will be injected into the component. If not, just not injected.
Only functions never trigger re-render
If only functions used in A, others update won't trigger A re-render.
Unused state never trigger re-render
If some state not used in A, others update won't trigger A re-render.
Unused loading never trigger re-render
If someFn.loading
not used in A, someFn()
won't trigger extra re-render.
If someFn
is async, with normal loading solutions, even someFn.loading
is not used, re-render will trigger at least twice (turn true
then false
). However, with flooks, no invisible loading updates, if someFn.loading
is not used.
API
useModel()
get()
& set()
* Interconnected modules - call get(anotherModel)
in someModel
to get other models, all models can be connected.