100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Web

Jotai

IntermediateFramework10.5K learners

Jotai is a minimal, atomic state management library for React that lets developers build application state from small, independently updatable units called atoms, avoiding the boilerplate of a single centralized store.

Definition

Jotai is a minimal, atomic state management library for React that lets developers build application state from small, independently updatable units called atoms, avoiding the boilerplate of a single centralized store.

Overview

Jotai (Japanese for "state") was created by Daishi Kato as a reaction to the ceremony required by store-based state managers like Redux. Instead of defining one large store and selectors to slice it, Jotai starts from individual atoms — small pieces of state created with `atom()` — and lets components subscribe to exactly the atoms they need via the `useAtom` hook. Because subscriptions are per-atom rather than per-store, components only re-render when the specific atom they read actually changes, which sidesteps the manual memoization and selector-writing that larger stores often require. Atoms can be primitive values, or derived atoms computed from other atoms, including async atoms that resolve promises and integrate cleanly with React Suspense. This composability lets state graphs emerge organically: a component can combine several small atoms instead of having a single reducer manage everything, and derived atoms recompute automatically when their dependencies change, similar to how spreadsheet formulas react to cell edits. Jotai's API surface is intentionally small — the core library is only a few kilobytes — but it ships an ecosystem of optional utilities (`jotai/utils`) for persistence, atom families (parameterized atoms), URL-synced atoms, and integrations with React Query and Immer. Because atoms are just JavaScript references rather than string keys, Jotai avoids the naming collisions and key-management overhead of context- or store-based approaches, and TypeScript inference works well without extra typing. Jotai is commonly reached for in React and Next.js applications that want fine-grained reactivity without adopting a heavier framework, particularly where component trees have many independent pieces of shared state (form fields, UI toggles, feature flags) rather than one large normalized data store.

Key Features

  • Atomic state model built from small, independently subscribable atoms
  • Fine-grained re-rendering — only components reading a changed atom re-render
  • Derived atoms computed from other atoms, updating automatically on dependency change
  • Native support for async atoms and React Suspense integration
  • No string-based keys or selectors; atoms are plain object references
  • Small core bundle size with an opt-in utilities package for advanced patterns
  • Atom families for creating parameterized, dynamically keyed atoms
  • Works alongside React Context and composes well with React Query

Use Cases

Managing UI state (modals, tabs, toggles) scattered across a component tree
Form state management with independently validated fields
Sharing server-derived data between distant components without prop drilling
Synchronizing state with the URL or localStorage via utility atoms
Building design-system components that need local-but-shareable state
Replacing scattered useState/useContext logic in mid-sized React apps
Suspense-driven data fetching patterns in Next.js App Router applications

Alternatives

Redux Toolkit · Redux TeamZustand · PoimandresRecoil · MetaMobX · Michel Weststrate

Frequently Asked Questions