CodeZettaInterview Hub

React · State · Junior · Concept

Why can setState appear async / batched?

Short Interview Answer

React batches updates for performance; reading state right after setState shows the old value.

Detailed Explanation

Use functional updates setCount(c => c + 1) when next value depends on previous. In React 18+, more updates batch automatically.

Did you know this answer?