useDoc
This is like store.useDoc but it also observers the updates on path
(push strategy) and forces the component to update.
Arguments
path
(string?, default: ""): The path to state that you want to read and updatedepth
(number?, default: 1): Same as depth in observe
Returns
(Array
): An array with the following elements in order
- State at path.
- A function to modify the state.
- Same as here
- A dispatch function for you to dispatch any action to the internal Redux store.
Example