zustand-best-practices
Installation
SKILL.md
Zustand best practices
Use when using Zustand for client-side global or shared state.
Store shape
- Keep stores small and focused by domain or feature.
- Split large global state into multiple stores instead of one giant store.
Updates and API
- Prefer actions inside the store for state updates (clear entry points).
- Keep business rules in store actions, not scattered across components.
Selectors and renders
- Use selectors to avoid unnecessary re-renders.
- Use shallow comparison when selecting multiple fields as an object.