MemotivaProps and State

What is the functional form of useState's setter?

Props and State

Audio flashcard · 0:13

Nortren·

What is the functional form of useState's setter?

0:13

The setter returned by useState can accept a function instead of a value. The function receives the previous state and returns the next state. This form is safer when updates depend on the current state, especially with batching and concurrent updates.