This is a ´n auto rerender state that returns a third value that can be used to rerender the view if the state is true.
It is a little bit of an effort because the third function needs to use useCallback but we cannot put the state
directly in the dependency list, because the callback should not change when the auto rerender flag changes.
1: auto rerender state, 2: set auto rerender state, 3: force render function that will only cause a rerender when
the auto rerender state is true or when the always value is set to true.
This is a ´n auto rerender state that returns a third value that can be used to rerender the view if the state is true.
It is a little bit of an effort because the third function needs to use useCallback but we cannot put the state directly in the dependency list, because the callback should not change when the auto rerender flag changes.