Reference: react/react#14259
Any state updates triggered inside that callback will be batched. Any state updates triggered outside that callback will not be batched. Timeouts, promises, and async functions will end up executing outside that callback, and therefore not be batched.
Update states multiple times like
within async function like api callback, timer etc...
will not batch updated
We can use useReducer to avoid redundant rendering calls.
Reference: react/react#14259
Update states multiple times like
within async function like api callback, timer etc...
will not batch updated
We can use
useReducerto avoid redundant rendering calls.