Docs

React — Interview Questions & Mental Models

Short 'round' questions they often ask


  • Virtual DOM — why? → Declarative UI + batched updates; diffing reduces direct DOM work; not 'faster than vanilla DOM' in every case.
  • What triggers a re-render? → State/context change in this tree, or parent re-render (unless memo + stable props).
  • Hooks rules? → Only call at top level of React functions; same order every render — no hooks in loops/conditions.
  • Refs vs state? → State triggers re-render; ref updates don't.
  • SSR/hydration mismatch? → Don't use Date.now() / random in initial HTML without suppressing or matching server output.
  • How would you share logic between components? → Extract custom hooks, composition, or render props — not inheritance.