Comparing
Create your next immutable state by mutating the current one
Primitive and flexible state management for React based on atomic state units.
| Metric | immer | jotai |
|---|---|---|
| Ecosystem | npm | npm |
| Difficulty | Beginner | Beginner |
| Weekly downloads | 41.7M↑ | 900K |
| Latest version | v11.1.4 | v2.9.3 |
| Recipes | 1 | 2↑ |
immer only
Shared
jotai only
Use Immer whenever you have deeply nested state updates that are painful to write immutably: Redux reducers, Zustand's set function, or React useState with complex objects. It's built into Redux Toolkit's createSlice, so you're probably already using it.
React apps needing shared state without prop drilling, derived/computed state that updates automatically, fine-grained re-render control, per-route or per-feature isolated state.
For flat, simple state (a counter, a boolean toggle), immer's overhead isn't worth it — just spread the object. Immer also has edge cases with classes, Maps, and Sets that require using enableMapSet() and enableAllPlugins().
Non-React environments (Jotai is React-only). Complex state machines (use XState). Apps already committed to Redux with large middleware ecosystems.
immer
jotai