When an unexpected bug occurs in a React application—such as a counter not updating, a dropdown refusing to close, or stale data displaying on screen—the issue almost always traces back to one of three questions:
1
Did the state actually change?
2
Did the new props reach the child component?
3
Did the component re-render when expected?
Using React DevTools and systematic logging techniques allows you to answer these three questions with scientific precision.
2. Inspecting Hook State in the Side Panel
When you select a functional component in the Components tree, the right-hand inspection drawer displays its internal details:
1[Components Tree] [Selected: <CourseList>]
2▼ <App> props:
3 ▼ <CourseDirectory> courses: Array(3)
4 ► <SearchInput> onSelect: f()
5 ▼ <CourseList> <──[Selected]
6 <CourseCard> hooks:
7 <CourseCard> 1. State: "frontend"
8 <CourseCard> 2. State: false
9 3. Effect: f()
Notice:
Hooks are labeled in order: 1. State, 2. State, 3. Effect.
In modern React, if you pass a label or inspect custom hooks, DevTools displays the custom hook names clearly.
You can click any state value, modify it (e.g. change "frontend" to "backend"), and watch React re-render the view instantly!
3. "What Caused This to Render?" in Profiler
Unnecessary re-renders are a leading cause of performance lag in React applications. The React DevTools Profiler provides the ultimate diagnostic answer:
1
Open the Profiler tab.
2
Click the blue Record circle.
3
Perform the user action (e.g. type in a search box or click a button).
4
Click Stop Recording.
5
Inspect the flamegraph: hover over any component.
DevTools displays an explicit breakdown:
Why did this render?
• Props changed: query
• State changed: filter
• Parent component <App> rendered.
4. Professional Console Debugging Techniques
Technique 1: Logging State Transitions with Functional Setters
1// Log the exact previous and next state values directly:
Technique 2: Monitoring Prop Changes with useEffect
To verify if a child component is receiving updated props:
1useEffect(()=>{
2 console.log('[Props Updated] User ID:', userId,'Role:', userRole);
3},[userId, userRole]);
Technique 3: Temporary debugger Statements
Inserting a debugger; statement inside an event handler or effect pauses browser execution at that exact line and opens the browser's debugger with full call stack inspection.
Interactive Quiz• Knowledge Check
Practice Quiz
Question 1
In React DevTools Profiler, what feature tells you the exact reason a component updated?
Question 2
How does React DevTools display hooks in functional components in the right-hand panel?
Question 3
What happens when you insert a debugger; statement into a React event handler and click that element with DevTools open?
Question 4
If a child component fails to display updated data, what should you inspect first in React DevTools?
Question 5
What does a flamegraph in the React Profiler display?
Next Lesson
Strict Mode and Detecting Unintentional Side Effects
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.