Course contentsShow
← React
Lesson 917 of 2,39624. React.memoFree lesson

The Parent Re-render Scenario: Why memo Exists

Without memo, child components re-render whenever parent re-renders, even with unchanged props.

The Parent Re-render Scenario: Why memo Exists

What you'll learn: Why child components unnecessarily re-render when their parent updates, and how this creates a performance problem that React.memo was designed to solve.

The Default React Behavior

By default, when a parent component re-renders, all of its child components re-render too—even if their props haven't changed at all. This happens because React doesn't automatically check whether props are different; it simply re-renders the entire component tree beneath any component that updates.

Why This Happens

Think of it like a chain reaction: when a parent component's state changes (say, a counter increments), React re-runs that component's function. During that re-run, it creates new JSX that includes the child components. React then renders those children again, even if you're passing them the exact same primitive values as before.

function Parent() {
  const [count, setCount] = useState(0);
  
  return (
    <div>
      <button onClick={() => setCount(count + 1)}>Count: {count}</button>
      <ExpensiveChild name="Alice" />
    </div>
  );
}

Every time you click the button, ExpensiveChild re-renders—even though name="Alice" never changes.

The Problem This Creates

For simple components, this is fine. But when child components perform expensive calculations, render large lists, or have deep component trees beneath them, these unnecessary re-renders waste CPU cycles and can make your UI feel sluggish.

This is exactly why React.memo exists: to give you an escape hatch that says "only re-render this child if its props actually changed."

Key Takeaway: Without React.memo, child components always re-render when their parent re-renders, regardless of whether their props changed—creating unnecessary work that can hurt performance.