When you connect Overmind to a component you ensure that whenever any tracked state changes, only components interested in that state will re-render, and will do so “at their location in the component tree”. That means we remove a lot of unnecessary work from React. There is no reason for the whole React component tree to reconcile when only one component is interested in a change.
The benefit of using specific hooks is that if you only need actions in a component, you do not add tracking behaviour to the component by using useActions. Also it reduces the amount of destructuring needed, as you can point to a namespace on the hook.
Rendering
When you use the Overmind hook it will ensure that the component will render when any tracked state changes. It will not do anything related to the props passed to the component. That means whenever the parent renders, this component renders as well. You will need to wrap your component with REACT.MEMO to optimize rendering caused by a parent.
Scoped tracking
The state hook is able to scope the tracking to a speciic value. This is especially useful in lists. In the example below we are passing the id of a todo to the Todo child component. Inside that component we scope the tracking to the specific todo value in the state tree. That means the Todo components does not care about changes to added/removed todos, only changes related to what you access on the specific todo.
The hook effect of React gives a natural point of running effects related to state changes. An example of this is is scrolling to the top of the page whenever the current page state changes.
Overmind supports React Native. What to take notice of though is that native environments sometimes abstracts away the main render function of React. That can be a bit confusing in terms of setting up the Provider. If your environment only exports an initial component, that component needs to be responsible for setting up the providers and rendering your main component: