React: Install the React Developer Tools

Next.js is based upon React, so one very useful tool we absolutely need to install (if you haven’t already) is the React Developer Tools.

Available for both Chrome and Firefox, the React Developer Tools are an essential instrument you can use to inspect a React application.

They provide an inspector that reveals the React components tree that builds your page, and for each component, you can go and check the props, the state, hooks, and lots more.

Once you have installed the React Developer Tools, you can open the regular browser dev tools (in Chrome, right-click on the page, then click Inspect) and you’ll find 2 new panels: Components and Profiler.

Note that you might have to click this icon to see the new tabs:

Untitled

Untitled

Once you’re in the Components tab, you’ll see the application components list:

Untitled

In this case, we only have 1 component.

But as your app grows in size and components, you’ll find this panel very useful

Untitled

as you will be able to inspect the component’s data:

Untitled

If you move the mouse over the components, you’ll see that on the page, the browser will select the parts that are rendered by that component.

If you select any component in the tree, the right panel will show you a reference to the parent component, and the props passed to it.

You can easily navigate by clicking around the component names.

You can click the eye icon in the Developer Tools toolbar to inspect the DOM element, and also if you use the first icon, the one with the mouse icon (which conveniently sits under the similar regular DevTools icon), you can hover an element in the browser UI to directly select the React component that renders it.

You can use the bug-shaped 🐞 icon at the top right of the panel to log component data to the console.

Untitled

Those are the basics.

This is a super powerful tool that will help you debug your React applications going forward.

Lessons in this unit:

0: Introduction
1: DEMO Setting up a React project with Vite
2: React Components
3: Introduction to JSX
4: Using JSX to compose UI
5: The difference between JSX and HTML
6: Embedding JavaScript in JSX
7: Handling user events
8: Managing state
9: Component props
10: Data flow
11: Lifecycle events
12: Managing forms in React
13: ▶︎ Install the React Developer Tools
14: DEMO Installing Tailwind CSS in a React app
15: DEMO Build a counter in React
Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. Launching May 21, 2024. Join the waiting list!