Skip to main content
React Interview Questions Theory P0 Medium

State snapshots, batching and functional updates

Why might several setCount(count + 1) calls in one handler increment only once? How would you increment three times?

Official Reference

Model Answer & Explanation

The handler closes over one render’s count. Those calls queue the same replacement value, and React batches the event updates. Passing prev => prev + 1 queues updaters that each receive the preceding pending value, so three such updates add three.

Follow-up Interview Question · What happens if the final queued update is a fixed replacement?

Module Context & References

React · Rendering & hooks theory Explain renders, reconciliation, keys, state, effects and performance
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.