State Batching in React js

  • React processes state updates after event handlers have finished running. This is called batching.
  • If you have updated your single state multiple times then React will read each state update and pass the most latest state to the useState() for next render.
  • To update some state multiple times in one event, you can use setNumber(n => n + 1) updater function.



To view or add a comment, sign in

Others also viewed

Explore topics