Course contentsShow
← React
Lesson 1502 of 2,39637. React 19 and BeyondFree lesson

The Manual Memoization Problem

Why developers struggle with useMemo, useCallback, and React.memo placement decisions in real applications.

The Manual Memoization Problem

You'll learn why memoization in React is notoriously difficult to get right, even for experienced developers.

The Cognitive Burden

React gives you three tools for preventing unnecessary work: useMemo, useCallback, and React.memo. The problem? You need to decide where and when to use them, and getting it wrong either wastes performance (under-memoizing) or wastes effort (over-memoizing). This decision-making process is mentally exhausting and error-prone.

Why It's So Hard

Dependency tracking: Every useMemo and useCallback requires a dependency array. Miss one dependency, and you have stale closures. Include too many, and your memoization breaks constantly.

Referential equality chains: Memoizing one component often requires memoizing everything it touches. If a parent passes a new callback to a memoized child, the child re-renders anyway. You end up playing whack-a-mole, adding useCallback here, React.memo there, creating cascading chains of memoization.

The "is this worth it?" question: Memoization has overhead. For simple components, the cost of checking whether to re-render can exceed the re-render cost itself. Developers constantly second-guess whether their optimization is actually helping.

The Real-World Impact

In practice, teams either:

  • Under-memoize and accept sluggish UIs
  • Over-memoize defensively, cluttering code with performance hints
  • Memoize inconsistently, creating confusion and bugs

The manual nature means every code review involves debating memoization placement, and refactoring becomes risky—move a function, and you might break a memoization chain you didn't know existed.

Key Takeaway: Manual memoization forces developers to constantly predict performance bottlenecks and maintain fragile dependency chains, turning what should be an implementation detail into a pervasive architectural concern.