Alternatives: Zustand and Jotai
You'll learn how modern state libraries sidestep React context entirely, solving the selective subscription problem with simpler, more ergonomic APIs.
The Context-Free Approach
While use-context-selector patches React's context re-render issues, libraries like Zustand and Jotai take a different path: they don't use context at all. Instead, they maintain state outside the React tree and let components subscribe directly to only the slices they need. No provider nesting. No context re-render cascades. Just clean, selective subscriptions built into the library from day one.
Why This Matters
Think of context like a bulletin board where everyone gathers to read announcements—even if only one line changed, everyone shows up. Zustand and Jotai are more like personalized newsfeeds: you subscribe to exactly what interests you, and updates only ping your subscription.
Zustand uses a store pattern with selectors baked in. Components can read specific state slices without triggering re-renders for unrelated data changes.
Jotai uses an atomic approach—tiny, independent pieces of state (atoms) that components subscribe to individually. No massive context object to worry about.
Both eliminate the need for splitting contexts, memoizing values, or reaching for use-context-selector. They're designed from the ground up for performance without the boilerplate.
When to Consider Them
If you've been wrestling with context re-render issues, splitting contexts repeatedly, or find yourself implementing selector patterns manually—these libraries offer a more ergonomic solution that's already optimized. They trade the familiarity of React's built-in tools for significantly better performance characteristics and developer experience in state-heavy applications.
Key Takeaway: Zustand and Jotai solve selective subscription natively by managing state outside React's context system, offering simpler APIs and better performance without manual optimization patterns.