I have this react app, and this component in specific, has a useReducer in order to save a lot of data that it handles.
The problem, is that i'm finding myself creating functions where i dispatch multiple actions, and i'm worried that this could cause performance-rendering problems like happens when you use redux.
When you use react-redux
you have the ability to use batch()
to only have 1 render when you have to dispatch multiple actions, but, when you use react useReducer hook, is there such thing like that ?
This is the code where i'm having this problem.
<Box
onClick={() => {
dispatchMetaState({
type: 'GET_CENTER_LOCATION',
payload: center,
});
dispatchMetaState({
type: 'ADJUST_ZOOM',
payload: zoom,
});
if(isResourceLocated !== '') dispatchMetaState({type:'UNLOCATE_RESOURCE'})
}}
>
</Box>
Any thoughts, ideas ?