The Context Re-render Problem
What you'll learn: Why updating a React Context value triggers re-renders in every component that consumes that context, even when they only care about a small slice of the data.
The Core Issue
When you change a Context value, React doesn't track which parts of that value each consumer actually uses. Instead, it assumes every consumer might care about the change and re-renders them all.
Imagine a bulletin board (Context) with weather, news, and sports scores. Even if you only check the weather section, whenever anything on the board updates—even just the sports scores—you're notified and forced to look at the entire board again. React treats all Context consumers this way: any change means everyone checks.
Why This Happens
Context uses a simple change detection: it compares the old value to the new value using Object.is(). If they're different, all consumers re-render. React doesn't examine whether Consumer A only reads context.user while Consumer B only reads context.theme—both re-render on any update.
This becomes problematic with a single large Context object:
const AppContext = React.createContext();
// Context holds: { user, theme, settings, notifications, cart }
// Component only uses theme, but re-renders when cart updates
Every field change cascades through every consumer, creating unnecessary render cycles you've already learned to detect with the Profiler.
The Hidden Cost
You've already measured context-induced re-renders and identified the object-value reference trap. Now you understand why those patterns matter: Context's all-or-nothing re-render behavior makes reference stability and value splitting critical optimization strategies.
Key Takeaway: Context re-renders every consumer on any value change because React doesn't track granular field access—it's a broadcast system, not a subscription to specific properties.