Profiling with React DevTools
Using the React DevTools Profiler's flamegraph and ranked chart to record a session, find a wasted re-render, and trace it back to its trigger.
Profiling with React DevTools
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- The React DevTools browser extension adds a Profiler tab, separate from the Components tab, built specifically for recording and inspecting render performance over time.
- A profiling session is a recording: you click record, interact with the app the way a user would, stop recording, and then inspect every render that happened in between.
- The flamegraph view shows one bar per commit, with each component's render time as a nested bar; width is render duration and color intensity signals relative cost, so wide, bright bars are where time actually went.
- The ranked chart view flattens that same commit into a sorted list of components by render time, which is faster for answering what the single most expensive thing in that commit was.
- A 'wasted render' shows up as a component rendering in a commit where its own output didn't actually change — exactly the parent-cascade or context-change triggers from the first lesson in this group, now visible instead of theoretical.
- Profiling before optimizing turns memoization from a guess into a targeted fix: wrap the specific component the flamegraph points at, then re-record to confirm the bar actually shrank or disappeared.
From theory to evidence
Every lesson in this group up to now has been about reasoning through re-renders on paper: what triggers one, how a cascade works by default, how React.memo, useMemo, and useCallback narrow it, and how the compiler can do some of that narrowing for you. None of that reasoning tells you which component in a real, running app is actually worth touching. Profiling is how you find out, by recording what actually happened instead of predicting it.
The Profiler tab and recording a session
Installing the React DevTools browser extension adds two tabs to your browser’s developer tools: Components, for inspecting the current tree and its props and state, and Profiler, for recording render performance over a span of time. They’re separate tools for separate questions — Components answers “what does the tree look like right now,” Profiler answers “what happened while I was interacting with it.”
A profiling session has a simple shape: click the record button, perform the interaction you care about — type in a search box, open a modal, scroll a list — the way a real user would, then stop recording. The Profiler then presents every commit that happened during that window. A commit is one pass where React actually wrote changes to the real DOM; each commit groups together every component that rendered as part of producing it.
Reading a commit: flamegraph and ranked chart
Each commit can be viewed two ways.
The flamegraph preserves the component tree’s shape. Each bar is a component, nested the way components are nested in your JSX, and a bar’s width represents how much of that commit’s total render time went to that component (and, implicitly, its children). Color intensity is a second signal on top of width — brighter or warmer colors generally mean relatively more expensive — but width is the number worth trusting first. Hovering a bar shows the exact render duration and why that component rendered (which props or state or context the Profiler determined triggered it).
The ranked chart takes the same commit and drops the tree structure entirely, instead listing every component that rendered, sorted from most to least expensive. It loses the parent-child context the flamegraph gives you, but it answers “what’s the single biggest line item in this commit” faster, because you don’t have to scan a nested tree to find the widest bar.
Neither view is strictly better; the flamegraph is better for understanding why something rendered (look at its ancestors), and the ranked chart is better for quickly spotting what costs the most in a given commit.
Finding a wasted render
The payoff case for this whole lesson group is what the Profiler calls a wasted render: a component that rendered in a commit without producing any different output. Mechanically, this is the parent-cascade trigger from the first lesson in this group, now made visible instead of theoretical — a component re-rendered only because something above it re-rendered, not because anything about its own props, state, or consumed context actually changed in a way that mattered.
Recording a session, finding a component that shows up wide or near the top of the ranked chart in commit after commit, and then checking what it actually renders — does its output ever differ across those commits? — is how you decide whether React.memo (from two lessons ago) is worth adding there specifically, rather than sprinkling it everywhere on a guess. Once you add the memoization, the correct next step is to profile again: record the same interaction, and confirm that component’s bar actually shrank or disappeared from the commit, rather than trusting that the fix worked.
This closes the loop this entire lesson group opened. Re-renders have specific, knowable triggers; useMemo, useCallback, and React.memo are the manual tools for narrowing them; the React Compiler can automate much of that narrowing on code it can analyze; and the Profiler is how you find out, with evidence from your actual running app, whether any of that narrowing was ever worth doing in the first place.
What the video covers
Web Dev Simplified’s video is built specifically around the Profiler tab, walking through its basic features and then its more advanced ones: recording a session, reading the flamegraph and ranked chart, and using that reading to find and fix a genuine wasted-render case end to end. It’s a close match for this lesson’s scope and a good watch for seeing the workflow performed live rather than described. The Profiler panel has had minor cosmetic changes since this video was published, but the flamegraph-and-ranked-chart workflow it teaches is unchanged.
Where this fits
This closes out the performance and memoization group. The next group moves from controlling re-renders to a different composition problem — passing data down a deep tree without drilling props through every level: context and avoiding prop drilling.
Check yourself
What is a profiling session in the React DevTools Profiler?
A recording. You start it, interact with the app, and stop it, and the Profiler then shows every commit that happened during that window, with the render time of every component that participated in each one.
What does the width of a bar represent in the flamegraph view?
How long that component took to render relative to the rest of the commit. A wide bar is a component that consumed a large share of that commit's total render time, which is why wide, brightly colored bars are the first place to look for a real cost.
How is the ranked chart view different from the flamegraph for the same commit?
The flamegraph preserves the component tree's nesting, showing parent-child relationships as nested bars. The ranked chart discards that structure and instead lists every component that rendered in that commit sorted by render time, which makes it faster to spot the single most expensive component without reading the tree shape.
How does a 'wasted render' found in the Profiler connect back to the triggers covered earlier in this group?
A wasted render is a component that re-rendered in a commit without its props, state, or consumed context value meaningfully changing — almost always because a parent re-rendered and cascaded down to it by default, or because it reads a context whose value changed for an unrelated reason. The Profiler makes that abstract trigger visible as a specific bar in a specific commit, which is what points you at the component actually worth memoizing.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.