React DevTools Cheat Sheet
Subject: React
π 1. Components Tab
π§ Feature | β What It Does |
---|---|
Component Tree | Displays your full app as a tree of React components |
Expand/Collapse | View parent-child relationships in deeply nested components |
Props Viewer | Shows all props passed to a component |
State Viewer | Shows useState / this.state values; editable live |
Hook Inspector | View all hooks like useState, useEffect, with current values |
Highlight in DOM | Hover to highlight the corresponding DOM element |
Search Bar | Find components by name (e.g., type "Header") |
π§ͺ Example:
Inspecting <Counter />
might show:
props: { start: 0 }
hooks: count = 3
β You can editcount
live to test UI!
π 2. Editing Props / State / Hooks
Feature | Description |
---|---|
Live Edit Props | Double-click any prop to change it live |
Live Edit State | Click state variable and update value instantly |
Edit Hook Values | Works for useReducer, useContext, etc. |
π Why itβs useful:
- Instantly test UI without code changes
- Debug forms, inputs, or API behavior
π 3. Highlight Component on Page
Feature | Description |
---|---|
π Highlight on hover | Hover tree to highlight the DOM element |
β Toggle highlighting | Use the "target" icon to turn highlighting on/off |
π§ Use Case: Perfect for debugging layout and style issues.
π 4. Profiler Tab
Only visible in development mode with Profiler enabled.
Feature | Description |
---|---|
β± Record Renders | Start/stop to capture re-render info |
π₯ Flame Graph | Visualize which components took time to render |
π Ranked View | Sort components by render time |
π‘ Use Case:
- Identify bottlenecks
- Optimize performance-heavy components
π 5. Component Source Location
Feature | Description |
---|---|
π Jump to Source | Show file and line of component (via source maps) |
π Click-to-open | Click path to open file in IDE (if properly configured) |
π 6. Hooks Display
Hook Type | What You See in DevTools |
---|---|
useState | Variable name and current value (e.g., count: 5 ) |
useReducer | State and dispatch function info |
useEffect | Not directly shown, but rerender timing shows in Profiler |
useContext | Displays current context value inside component tree |
π 7. React Strict Mode Support
If using <React.StrictMode>
, DevTools helps you:
- See double renders
- Spot unsafe lifecycle methods
- Detect unexpected state mutations
Youβll find warnings in the Profiler or browser console.
π Summary Table
Feature | What It Does | Use Case |
---|---|---|
Component Tree | View component hierarchy | Understand structure |
Props/State/Hook Inspector | Live view + edit of component data | Test dynamic behavior |
Highlight in DOM | Connect UI with component logic | Debug layout issues |
Profiler | Measure render performance | Optimize slow parts of app |
Jump to Source | Find component code quickly | Debug/edit faster |
Search Components | Filter by component name | Explore large apps |
Edit in DevTools | Simulate form input, auth, error UI states | Faster than code editing for testing |
π§ͺ Final Tip: Use it Like a Debug Console for React
React DevTools is your React Command Center β it helps you:
- π Debug more easily
- βοΈ Understand unfamiliar apps
- π Optimize performance
- π§ͺ Test UI states without rewriting code
Advertisement Slot 1
Advertisement Slot 2