state snapshot
The idea that during one render every state value is fixed, so code in that render always sees the same value even after calling a setter.
In more detail
Calling setCount(count + 1) three times in one click still adds only one, because each call reads the same snapshot value. The new value appears in the next render. Updater functions avoid the problem by receiving the latest pending value instead.
Related terms
- useState — The React hook that adds a state variable to a component and returns the current value with a function to change it.
- updater function — A function passed to a state setter that receives the latest pending state and returns the next state.
- automatic batching — React groups several state updates made in the same event or task into a single re-render.
Taught in
- State with useState: Immutability And Asynchronous Batching — React 19 & Modern Component Architecture