DeployU
Interviews / Frontend Engineering / A critical component is crashing in production. How would you debug it?

Questions

A critical component is crashing in production. How would you debug it?

debugging Debugging & Tools Interactive Quiz
Wrong Approach

I would add console.log statements everywhere and try to reproduce the bug locally.

Right Approach

First, I need to contain the crash and gather data systematically. Here's my approach:

Step 1: Containment with Error Boundaries

My first step isn’t to fix the bug—it’s to stop the bleeding and gather intel.

  • Action: Wrap the dashboard in an Error Boundary
  • Why: It catches errors in the component tree, renders a fallback UI, and logs the exact error + stack trace to monitoring (Sentry, Datadog)

Step 2: Inspection with React DevTools

With error logs coming in, I reproduce the bug locally.

  • Components Tab: Inspect props and state of the crashing component. Look for undefined values or impossible states.
  • Profiler: Record the rendering sequence to see what’s changing on each commit.

Step 3: Targeted Analysis with Breakpoints

Once I have a theory, I dive into the code.

  • Use debugger; or browser breakpoints instead of console.log
  • Inspect the call stack, variable values, and step through line-by-line

This methodical process—Contain, Gather, Inspect, Analyze—is how senior engineers debug complex production issues.

Practice Question

What is the primary function of the 'Components' tab in the React DevTools?