State Managers
Jotai
Jotai integrates through createJotaiStoreAdapter — a thin bridge between an atom and the store instance that owns it, or a custom adapter handling both full array hydration and live sparse delta updates.
Prerequisites
- An atom created with atom() and a store instance from createStore() — see Jotai's docs if you're new to it
- Familiarity with register() — see api/register
1
A plain Jotai atom and store
Nothing Flux-specific goes into either the atom or the store yet. Jotai has no implicit global store the way Zustand has a hook, so an explicit store instance is what Flux's adapter will need next.
typescript
2
Registering with createJotaiStoreAdapter
Wrap the atom and store together with
createJotaiStoreAdapter and pass the result as store — the adapter takes the atom first, then the store.typescript
3
Why Jotai needs an adapter
An atom has no
setState of its own to fall back to — it's a definition, not a container. The adapter exists purely to give dispatchToStore's fallback path something to call.typescript
4
Handling sparse updates and single delta frames
When streaming live updates over WebSocket, SSE, or Socket.IO, your backend will stream single delta frames (
CREATE, sparse UPDATE, and DELETE) alongside initial full array hydration payloads. Write a custom adapter object to handle both intake shapes:typescript
Or keep
createJotaiStoreAdapter and perform the sparse merge inside hydrateState:typescript
5
One store instance, everywhere
If your component tree renders a Jotai
<Provider>, the store passed to it and the store passed to createJotaiStoreAdapter (or custom adapter) must be the exact same instance.typescript
Mismatched store instances fail silently
There's no error thrown if the Provider's store and the adapter's store diverge — Flux writes to one atom graph, your components read from another, and the UI simply never updates. If a Jotai-registered channel looks like it's not dispatching, check this first.
6
Combining with scope
Jotai registrations take
scope exactly like any other state manager — the adapter layer has no awareness of multi-tenant scoping at all.typescript
7
Jotai vs. the other adapters
Jotai is one of two state managers that benefit from an explicit adapter factory — the other being Redux.
typescript
For Zustand, Flux's native option, see state-managers/zustand. For Redux, see state-managers/redux. For Stunk, see state-managers/stunk. For every other registration field alongside store, see api/register.