Proposal: Deprecate Zustand in Favor of TanStack Query + Context
Summary
I propose we deprecate Zustand for new development and gradually migrate away from it. The problems it was designed to solve now have simpler solutions built into React and TanStack Query (Which mobile also uses).
Current State
Parts of our legacy codebase use Zustand for global state management. However, none of our new code uses it - we've naturally gravitated toward TanStack Query and React Context instead.
AFAIK there is currently only 1 file using this as a dependency:
Why This Change Makes Sense
-
React has evolved - The Context API + hooks now handle most state sharing needs without external dependencies
-
TanStack Query already handles most "global state" - Data fetching, caching, mutations, and invalidation account for ~90% of what previously required global state libraries
-
Reduced complexity - Two patterns instead of three:
- Server state → TanStack Query
- UI state → React Context (when needed)
Global state → Zustand ← Remove this layer
-
Alignment with mobile - Our mobile app uses TanStack Query + Context successfully. Why maintain different patterns?
-
Fewer dependencies - One less library to maintain, update, and onboard new developers on
Proposed Approach
- New features: Use TanStack Query + Context only
- Existing Zustand code: Leave as-is unless actively refactoring that area
- During refactoring: Migrate server data to TanStack Query, UI state to Context
When Would Zustand Still Make Sense?
Admittedly, in scenarios with:
- Dozens of unrelated components sharing complex client-side state
- Proven performance bottlenecks from Context re-renders
- Heavy derived state computations
I don't think this describes our app - but open to discussion.
Open Questions
Thoughts?
Proposal: Deprecate Zustand in Favor of TanStack Query + Context
Summary
I propose we deprecate Zustand for new development and gradually migrate away from it. The problems it was designed to solve now have simpler solutions built into React and TanStack Query (Which mobile also uses).
Current State
Parts of our legacy codebase use Zustand for global state management. However, none of our new code uses it - we've naturally gravitated toward TanStack Query and React Context instead.
AFAIK there is currently only 1 file using this as a dependency:
Why This Change Makes Sense
React has evolved - The Context API + hooks now handle most state sharing needs without external dependencies
TanStack Query already handles most "global state" - Data fetching, caching, mutations, and invalidation account for ~90% of what previously required global state libraries
Reduced complexity - Two patterns instead of three:
Global state → Zustand← Remove this layerAlignment with mobile - Our mobile app uses TanStack Query + Context successfully. Why maintain different patterns?
Fewer dependencies - One less library to maintain, update, and onboard new developers on
Proposed Approach
When Would Zustand Still Make Sense?
Admittedly, in scenarios with:
I don't think this describes our app - but open to discussion.
Open Questions
Thoughts?