What is Jotai?
Answer
Jotai (Japanese for "state") is an atomic state management library for React inspired by Recoil. Instead of one store, Jotai uses atoms — tiny units of state. Define atoms: import { atom } from 'jotai'; const countAtom = atom(0); const userAtom = atom({ name: "", email: "" });. Use in components: const [count, setCount] = useAtom(countAtom);. useAtomValue(countAtom): read only. useSetAtom(countAtom): write only. Derived atoms: compute from other atoms: const doubledAtom = atom((get) => get(countAtom) * 2);. Async atoms: const userAtom = atom(async () => await fetchUser()); — works with React Suspense. Key features: Bottom-up: components subscribe to only the atoms they use — granular re-renders. No Provider required (provider-less mode). Tiny bundle: ~2KB. Jotai is excellent for fine-grained state where different parts of the UI need different atoms, and for Suspense-integrated async state.