intermediate
Zustand
Small store primitives for React and vanilla state with selectors, slices, and optional persistence.
Zustand is a minimal store primitive: create a hook-backed store with set/get, subscribe with selectors, optional middleware. Less ceremony than Redux; more structure than raw Context.
Subtopics: store slices, selectors, persist middleware.
On interviews: when Zustand beats Redux for small/medium apps; how selector subscriptions limit re-renders.
Common pitfalls: one unstructured mega-store, selecting entire state, and persisting secrets.
Checklist:
- create() per cohesive domain or merged slices.
- Select minimal state per component.
- Middleware for persist/devtools as needed.
- Keep server cache in query libraries.