An event handler calls setCount(count + 1) twice. Product expects the count to go up by two. Explain why it goes up by one and how you would change the handler without forcing another render between updates.
Both calls read count from the same render snapshot and queue the same replacement value. Functional updates, setCount(n => n + 1) twice, queue two transformations that run in order on the pending state. Batching does not prevent multiple changes from composing when they are expressed as updaters.
What a Strong Answer Covers
Explain the render snapshot and replacement updates.
Use functional updaters and explain why they compose.
Follow-up Interview Question · If you queue a fixed value after both updaters, which update determines the result?