Thiru LogsAll FAQs
Frontend Development ยท React

How would you answer an interview scenario involving state and useState in React?

AdvancedUpdated 2026-08-08

For a counter updated rapidly from multiple events, use setCount(previous => previous + 1) so each update is based on the latest state rather than a captured value.

#react#state-usestate