Interview Q&A / React
React interview questions
Rendering, state, hooks, keys and effects, explained with small examples.
Prefer rapid revision? Practise React short interview answers →
- How would you write a useDebounce hook for a search box?
Keep a debounced copy of the value in state. In an effect, start a setTimeout that updates the copy after a delay, and clear that timer in the cleanup so only the last change within the delay goes through.
IntermediateQuick answer1 min read