Course contentsShow
← React
Lesson 1695 of 2,39641. State Management EcosystemFree lesson

Context Limitations: No Selectors

Understand that Context consumers re-render on any value change—no fine-grained subscriptions.

Context Limitations: No Selectors

You'll learn why Context can cause unnecessary re-renders and what "no selectors" means.

The Core Problem

When you use React Context, every component that consumes that context will re-render whenever any part of the context value changes—even if that component only uses a tiny slice of the data.

Context has no built-in way to "subscribe to only part of the data." You consume the whole value, you re-render on every change. This is what "no selectors" means: you can't cherry-pick which updates matter to you.

The Subscription Model

Think of Context like a newspaper subscription. You either subscribe to the whole paper or nothing at all. Even if you only read the sports section, you still get notified (re-render) when the weather section changes.

Libraries like Redux or Zustand offer selectors—functions that let you say "I only care about state.user.name" and you'll only re-render when that specific piece changes. Context doesn't have this mechanism.

Why This Matters

If your context value is an object with multiple properties, and you wrap a large part of your app:

const AppContext = createContext({ user, theme, settings, cart })

Every consumer re-renders when any of those properties change—even if a component only displays the theme.

This is why splitting contexts (one for user, one for theme) helps performance, but it's still a manual, coarse-grained solution compared to automatic selector-based subscriptions.

Key Takeaway: Context consumers always re-render on any value change—there's no built-in way to subscribe to only part of the data, making Context less efficient for large, frequently-updated state compared to libraries with selectors.