π οΈ Using React DevTools
React Developer Tools is a powerful browser extension that allows you to inspect the component hierarchy, props, state, and hooks in your React apps.
π¦ 1. Installation
π 2. Key Features
- Component Tree: Visualize the component hierarchy
- Props & State: View and edit live values
- Hooks: See hook names and values (e.g.,
useState
,useReducer
) - Profiler: Measure render time and performance bottlenecks
π§ 3. How to Use
- Open your app in the browser
- Open Developer Tools (Right click β Inspect or F12)
- Switch to the βοΈ Components or Profiler tab
- Click on a component to inspect its props, state, and hooks
π 4. Profiler Tab
The Profiler lets you:
- Record rendering performance
- Find unnecessary re-renders
- Optimize slow components
π‘ You can rename hooks in DevTools by naming your custom hooks clearly (e.g.,
useAuth()
instead of useSomething()
).
β Bonus Tips
- Use the search bar to find components fast
- Click the eye icon to highlight the DOM node in the page
- Use the βRendered byβ section to trace component hierarchy