Question presented to candidate: "A bug report says a page shows stale data and feels sluggish. Walk me through how you would debug that in a React app."
What a strong answer should cover:
- A method, not a tool list: reproduce, narrow to a component, then inspect the data flowing into it.
- React DevTools Components for wrong values — props, state, hooks, context, and the owner chain that answers "where did this come from?".
- React DevTools Profiler for slow interactions, with "record why each component rendered" enabled.
- StrictMode as a proactive detector of impure renders and missing effect cleanup, not a nuisance.
- Error Boundaries to catch render-phase crashes and show a real fallback plus a component stack.
- Knowing what an Error Boundary does not catch: event handlers, async code, SSR, and errors in the boundary itself.
- React 19 additions:
captureOwnerStackfor the chain of components that created an element. - Ordinary JavaScript debugging still applies — breakpoints, conditional breakpoints, the network panel.
- The common root causes worth naming: stale closures, missing effect dependencies, and unstable object or function identities.
Clarifying questions expected:
- "Does it reproduce in development, or only in production?" — that changes the toolkit entirely.
- "Is it wrong data, a crash, or slowness?" — the three lead to different tools.
Code / implementation expected: Optional. An Error Boundary is the one piece of code worth being able to write from memory.