Course contentsShow
← React
Lesson 2276 of 2,39650. Performance: Optimization TechniquesFree lesson

When NOT to Use memo: Profiling Says No

Remove unnecessary memo when Profiler shows negligible or negative impact.

When NOT to Use memo: Profiling Says No

You'll learn when to remove React.memo because your performance measurements prove it's not helping.

The Core Idea

Not every component benefits from React.memo. Sometimes the cost of the shallow equality check itself outweighs any savings from skipping a re-render. Other times, your component renders so quickly that preventing the re-render provides negligible benefit—maybe saving 0.5ms when the user would never notice. The Profiler is your evidence.

When the Data Says "No"

After wrapping a component in React.memo and using the Profiler to compare before/after:

  • Render time didn't improve meaningfully (saved <1ms on average commits)
  • Render time got worse (the memo check is more expensive than the render)
  • The component almost never skips renders (props change every time anyway)

These are clear signals to remove React.memo. Keeping it adds code complexity, maintenance burden, and potentially slower performance—all for zero gain.

The Evidence-Based Approach

Think of React.memo like a vitamin supplement: you shouldn't take it "just in case." You take it when blood work shows a deficiency. Similarly, profile first, identify the problem, apply memo, profile again, and if the measurements don't show improvement, remove it.

A fast component that re-renders 50 times per second might still be fine if each render takes 0.2ms. Don't optimize what isn't slow.

Example Scenario

You wrapped <UserAvatar> in memo, but the Profiler shows it renders in 0.3ms regardless. The parent changes the userId prop constantly, so memo never skips. The equality check adds 0.1ms overhead. Result: net loss. Remove memo.

Key Takeaway: If the Profiler shows negligible or negative impact after adding React.memo, remove it—optimization without measurement is guesswork, not engineering.