What it is
Zustand is a small state management library built around a single create call that returns a hook. There is no provider to wrap your tree and no action type ceremony.
How it works
The create function receives set and get. You define state fields and the functions that update them. Components call the hook with a selector to read just the slice they need.
- set: merges a partial update into the store.
- get: reads the current state inside actions.
- selector: picks the minimal data a component needs.
Why selectors matter
A component that selects one field only re renders when that field changes. Reading the whole store would re render on any change. Pairing a selector with a shallow equality check keeps updates tight.
- No context provider required.
- State and actions live together.
- Subscriptions are scoped by selector.
Key idea
Zustand gives you a provider free hook store where selectors scope subscriptions so components re render only on the data they actually use.