zustand-patterns
Installation
SKILL.md
Zustand State Management Patterns
Core Principles
Use Zustand for client state only. Never store server data in Zustand stores. Use TanStack Query (REST) or Apollo Client (GraphQL) for server state.
Why: Separating client and server state prevents sync issues and enables optimistic updates with proper cache invalidation.
When to Use This Skill
Use Zustand when you need to:
- Manage UI interaction state (modals, dropdowns, selected items)
- Handle form validation states
- Implement client-side filters and sorting
- Store user preferences before persistence
- Implement state machines for complex UI flows