jotai
Jotai is a minimal, atom-based state management library for React built around tiny composable "atoms" of state that can be derived, combined, and made async. It avoids string keys, integrates with Suspense, and scales from a useState replacement to large TypeScript apps.
MITPermissive — free to use in commercial and proprietary software, with attribution.View license →
Production readiness
4/5- Actively maintainedCommits in the last 6 months
- No known vulnerabilitiesNot yet scanned
- Clear, usable licenseMIT (permissive)
- Proven adoptionWidely used
- Has documentationDocumentation indexed
npm install jotaiOur analysis
Jotai is a primitive and flexible state management library for React that models state as small composable units called atoms. Atoms can hold primitive values, be derived from other atoms, support async read/write, and integrate with React Suspense.
When to use jotai
Reach for Jotai when you want fine-grained, bottom-up React state that avoids unnecessary re-renders, when you need derived/computed state or async data integrated with Suspense, or when you find Context too coarse and Redux too heavy. Its tiny core and TypeScript-first design suit both small components and large apps.
When not to
If you need framework-agnostic state outside React, a global store with time-travel devtools and strict action/reducer conventions (Redux Toolkit), or a mutable proxy model (Valtio/MobX), other tools fit better. For trivial local state, plain useState is enough; for server-cache-heavy apps, a data-fetching library like TanStack Query may be more appropriate than rolling async into atoms.
Strengths
- Extremely small core (~2kb) with a minimal, easy-to-learn API
- No string keys, avoiding Recoil-style key collision boilerplate
- First-class derived atoms and async/Suspense support
- Excellent TypeScript inference and strong pmndrs ecosystem of utilities/integrations
- Fine-grained subscriptions reduce re-renders compared to Context
Trade-offs
- React-only; not a general-purpose state container
- Atom-graph thinking and the bottom-up model have a conceptual learning curve
- Many features live in separate utility packages, so capabilities are spread across add-ons
- Debugging large interdependent atom graphs can be harder than a single centralized store
- Async-in-atoms can blur the line with dedicated data-fetching tools
Maturity
Mature and widely adopted (20k+ stars), maintained by the well-known pmndrs collective alongside Zustand, Valtio, and React Three Fiber. It has stable v2 releases, thorough docs, and a broad ecosystem of integrations (Immer, Query, Redux, URL, persistence).


visit jotai.org or npm i jotai
Jotai scales from a simple useState replacement to an enterprise TypeScript application.
Minimal core API (2kb)
Many utilities and extensions
No string keys (compared to Recoil)
First, create a primitive atom
An atom represents a piece of state. All you need is to specify an initial value, which can be primitive values like strings and numbers, objects, and arrays. You can create as many primitive atoms as you want.
import { atom } from 'jotai'
const countAtom = atom(0)
const countryAtom = atom('Japan')
const citiesAtom = atom(['Tokyo', 'Kyoto', 'Osaka'])
const mangaAtom = atom({ 'Dragon Ball': 1984, 'One Piece': 1997, Naruto: 1999 })
Use the atom in your components
It can be used like React.useState:
import { useAtom } from 'jotai'
function Counter() {
const [count, setCount] = useAtom(countAtom)
return (
<h1>
{count}
<button onClick={() => setCount((c) => c + 1)}>one up</button>
...
Create derived atoms with computed values
A new read-only atom can be created from existing atoms by passing a read
function as the first argument. get allows you to fetch the contextual value
of any atom.
const doubledCountAtom = atom((get) => get(countAtom) * 2)
function DoubleCounter() {
const [doubledCount] = useAtom(doubledCountAtom)
return <h2>{doubledCount}</h2>
}
Creating an atom from multiple atoms
You can combine multiple atoms to create a derived atom.
const count1 = atom(1)
const count2 = atom(2)
const count3 = atom(3)
const sum = atom((get) => get(count1) + get(count2) + get(count3))
Or if you like fp patterns ...
const atoms = [count1, count2, count3, ...otherAtoms]
const sum = atom((get) => atoms.map(get).reduce((acc, count) => acc + count))
Derived async atoms
You can make the read function an async function too.
const urlAtom = atom('https://json.host.com')
const fetchUrlAtom = atom(async (get) => {
const response = await fetch(get(urlAtom))
return await response.json()
})
function Status() {
// Re-renders the component after urlAtom is changed and the async function above concludes
const [json] = useAtom(fetchUrlAtom)
...
You can create a writable derived atom
Specify a write function at the second argument. get will return the current
value of an atom. set will update the value of an atom.
const decrementCountAtom = atom(
(get) => get(countAtom),
(get, set, _arg) => set(countAtom, get(countAtom) - 1)
)
function Counter() {
const [count, decrement] = useAtom(decrementCountAtom)
return (
<h1>
{count}
<button onClick={decrement}>Decrease</button>
...
Write only derived atoms
Just do not define a read function.
const multiplyCountAtom = atom(null, (get, set, by) =>
set(countAtom, get(countAtom) * by),
)
function Controls() {
const [, multiply] = useAtom(multiplyCountAtom)
return <button onClick={() => multiply(3)}>triple</button>
}
Async actions
Just make the write function an async function and call set when you're ready.
const fetchCountAtom = atom(
(get) => get(countAtom),
async (_get, set, url) => {
const response = await fetch(url)
set(countAtom, (await response.json()).count)
}
)
function Controls() {
const [count, compute] = useAtom(fetchCountAtom)
return (
<button onClick={() => compute('http://count.host.com')}>compute</button>
...
Note about functional programming
Jotai's fluid interface is no accident — atoms are monads, just like promises! Monads are an established pattern for modular, pure, robust and understandable code which is optimized for change. Read more about Jotai and monads.