zustand
Installation
SKILL.md
Zustand Best Practices
For server state, use
react-queryskill. For component state, usereact-best-practicesskill.
Store Creation
// BAD: no type annotation, no curried call
const useStore = create((set) => ({
count: 0,
increment: () => set((s) => ({ count: s.count + 1 })),
}));
// GOOD: typed with curried ()() for middleware inference
interface CountState {
count: number;
increment: () => void;
}