Hooks
There are 4 three basic hooks in zoov module.
And is defined in two ways: get the hook from module instance, or use the public hook API.
module.useState
module.useActions
oruseModuleActions(module)
module.useComputed
oruseModuleComputed(module)
module.use
oruseModule(module)
useState
You may use react-tracked
by dai-shi to automatically generate selector.
Zoov also provide a adapter on react-tracked. But don't use this function as a replacement of module.useActions
If you don't specify the state, the react-tracked will think that you are using the full state.
useActions
This hook will never trigger a rerender, you don't need to worry about the hooks performance.
useComputed
computed values are getter functions, the real thing under getter is a selector hook.
So, you should extract it when useComputed.
The computed hooks have some limitions, you can get more info from the Computed part
Last updated