#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Debugging Techniques (React)

Using React Dev Tools

React Developer Tools is a browser extension for Chrome, Firefox and Edge that adds two panels to your browser's developer tools: Components and Profiler. The Components panel shows your app as a tree of React components rather than raw HTML, and lets you inspect and edit each one's props, state and hooks while the app runs. The Profiler records renders so you can see which components re-rendered and how long they took. After learning breakpoints, this is the React-specific half of debugging.

Exploring the Components panel

Open your app, open developer tools and switch to the Components tab. You will see component names such as App, Header and TodoList nested the way you wrote them. Selecting one shows, on the right side:

  • props passed in by its parent;
  • hooks, listed in call order, including State, Effect, Context and any custom hooks by name;
  • rendered by, the chain of parents that produced it;
  • the source file location, when source maps are available.

You can double-click a state value or prop and change it. The component re-renders immediately, which is a fast way to test how the UI looks with an empty list, a long name or an error flag, without editing code.

Finding a component on the page

Click the picker icon at the top left of the panel and then click any element on the page. The tree jumps to the component that rendered it. The search box filters the tree by name, which helps in large apps. Hovering over a component in the tree highlights it on the page.

Jumping between DevTools and code

A few buttons in the selected component's toolbar are easy to miss. One logs the component's props, state and hooks to the console, where you can expand them freely. Another opens the source in the Sources panel. A third lets you inspect the matching DOM element. Inside the console, the currently selected component is available as $r, so you can run things like:

// In the browser console after selecting a component
$r.props          // see its props
$r.props.items.length

// For named custom hooks, add a debug label inside the hook:
import { useDebugValue, useState } from 'react';

function useOnlineStatus() {
  const [online, setOnline] = useState(navigator.onLine);
  useDebugValue(online ? 'Online' : 'Offline');
  return online;
}

useDebugValue shows a readable label next to a custom hook in the panel instead of a raw value.

Seeing why things re-render with the Profiler

In the Profiler tab, press record, use the app, then stop. You get a flame chart of each commit, showing which components rendered and how long each took. In the settings, turn on "Record why each component rendered while profiling" to see reasons such as "props changed" or "hooks changed". There is also an option in the Components settings to highlight updates as they happen, which flashes a border around each re-rendering component.

Common confusion when using it

Many people see the panels missing and assume the extension is broken. The tabs appear only on pages that use React; on a plain HTML page they stay hidden. If the extension icon is grey on a local file opened with file://, allow the extension file access in the browser's extension settings or serve the app with a dev server.

Another source of confusion is that the Profiler numbers in development are slower than real production timing, because development builds include extra checks. Use them to compare components against each other, not as absolute speeds. Also remember that Strict Mode in development intentionally renders components twice, which can look like a bug in the tree when it is not.

How to make it part of your routine

When something looks wrong, select the component and check its props and state first; most bugs are a wrong value, not wrong JSX. When the app feels slow, profile one interaction and look for components that render without need.

Ready to master real-world web development?

Learn HTML, CSS3, Bootstrap and JavaScript hands-on with mentor-led sessions.

Explore Course