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

Moving State Down to Reduce Re-render Scope

Learn how pushing state closer to where it's used prevents parent re-renders from cascading to unrelated components.

Moving State Down to Reduce Re-render Scope

You'll learn how keeping state closer to where it's actually used prevents unnecessary re-renders from spreading through your component tree.

The Core Idea

When you place state at the top of a component tree, every state change triggers a re-render of that parent and all its children—even children that don't care about that state. By moving state down into the specific component that needs it, you limit the "blast radius" of re-renders.

Think of it like turning on lights in your house. If the main breaker is the switch, turning on the bathroom light powers the whole house. But if each room has its own switch, only that room lights up. State placement works the same way.

Why This Matters Before Reaching for memo

Before wrapping components in React.memo or sprinkling useCallback everywhere, ask: does this state really need to live here? Often, state sits in a parent component out of habit, not necessity.

If <ParentComponent> has state that only <Sidebar> uses, but <ParentComponent> also renders <Header>, <MainContent>, and <Footer>, every sidebar interaction re-renders all four children. Move that state into <Sidebar>, and suddenly only the sidebar re-renders.

The Pattern

Instead of lifting state up by default, push it down until you need to share it. You can always lift it later if multiple components actually need access. This "colocation" strategy keeps renders localized and often eliminates the need for memoization entirely.

Key Takeaway: State living higher in the tree than necessary creates a wider re-render scope—move state down to the component that owns the UI it affects, and unrelated siblings won't re-render when it changes.