What it is
Jotai models state as many small independent atoms rather than a single store. An atom is a unit of state, and components subscribe to exactly the atoms they read.
Primitive and derived atoms
- Primitive atom: holds a value with an initial state.
- Derived atom: computes from other atoms with a read function and may also be writable.
Because atoms are composed, a derived atom forms a small dependency graph. When a base atom changes, only the atoms and components downstream of it update.
Why bottom up helps
There is no central reducer or giant state object. You add an atom when you need state and combine atoms to build larger pieces. This keeps re renders granular and avoids selector heavy boilerplate.
- Subscribe per atom, not per store.
- Derived atoms cache like computed values.
- Atoms can be created on demand.
Key idea
Jotai builds state from small composable atoms so components and derived atoms update only when the specific atoms they depend on change.