Demonstrating Skipped Renders with DevTools Profiler
You'll learn how to use React DevTools Profiler to visually confirm that React.memo is actually preventing unnecessary re-renders.
The Core Idea
When you wrap a component with React.memo, React skips re-rendering it if props haven't changed. But how do you know it's working? The React DevTools Profiler shows you exactly which components rendered and which were skipped during each update. It's like having X-ray vision into your app's render behavior.
How to See It in Action
Open React DevTools in your browser, switch to the Profiler tab, and click the record button (blue circle). Then interact with your app—trigger a parent component to re-render. Stop recording and examine the flame graph.
Components that rendered will appear in the graph with a colored bar showing render time. Components wrapped with React.memo that skipped rendering won't appear in that update at all, or will show "Did not render" in their details. This is your proof that memoization worked.
What You're Looking For
Compare two scenarios:
- Without
React.memo: Child components appear in every profiler recording when the parent re-renders - With
React.memo: Child components disappear from recordings when their props stay the same (referentially equal)
Think of it like a security camera—the Profiler records which components "moved" (rendered) during each frame. Memoized components with unchanged props simply don't show up because they stayed still.
Key Takeaway: The React DevTools Profiler is your visual confirmation that React.memo is successfully preventing re-renders—memoized components with equal props will be absent from the flame graph or explicitly marked as skipped.