state

React

State update functions in React

Whenever you update state based on previous state, use an update function to avoid stale state problems.

Read