Skip to content

Jotai

A small React state library where you manage state as independent 'atoms'.

Stars
21.3k
Forks
731
Licence
MIT
Language
TypeScript
Last update
14 days ago
Type
Library

What it is

Jotai is a state management library for React apps. You store pieces of state as small units called atoms, and components read and update them much like React's useState. Atoms can also be derived from other atoms, so values stay in sync automatically. The README says the core API is about 2kb and that it scales from simple use to larger TypeScript applications.

  • Store a counter or form value in an atom and share it across components
  • Create a derived atom that computes a total from several other atoms
  • Fetch data from a URL inside an async derived atom and render it when ready
  • Build a write-only atom that performs an action such as multiplying a count

Great for

  • React developers who want simple shared state without heavy setup
  • Teams that find a single large store too rigid and want state split into small pieces
  • TypeScript projects that want typed state
  • Apps that need derived values or async data fetched from state

Not ideal for

  • Non-React projects, since the README only shows React usage
  • People who are new to programming, since concepts like derived and async atoms take some learning
  • Teams that prefer a single central store with strict conventions, since Jotai favors small independent atoms
Step-by-step guide: how to use JotaiInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · npm

    Install from npm

    npm i jotai
  2. 2

    Run it

    • Install the package with npm i jotai
    • Import atom and useAtom from 'jotai'
    • Create a primitive atom with atom(0) or a similar initial value
    • Call useAtom(yourAtom) inside a React component to read and set it
  3. 3

    Get the most out of it

    • Use derived atoms with atom((get) => ...) to compute values from other atoms
    • Write write-only atoms to group state-changing actions in one place
    • Use async read functions to fetch data inside derived atoms, with Suspense as the README notes
    • Read the documentation at jotai.org/docs for utilities and extensions the README mentions

Downloads

Strengths

  • Minimal core API, which the README describes as about 2kb
  • Works like React's useState, so the learning curve is small for basic use
  • Derived and async atoms let state logic live alongside the data

Trade-offs

  • The README's async examples note that they need React Suspense, which adds setup considerations
  • Atom-based design differs from single-store libraries, so existing patterns may need rethinking
  • The README is truncated here, so advanced features and their limits are not covered in this entry

How it compares

ProjectStarsTypeLevelUpdatedBest for
jotai (this)21.3kLibrarybeginner14 days agoReact developers who want simple shared state without heavy setup
Recoil19.4kLibraryintermediate1.8 years agoReact developers who want shared state beyond simple prop passing
zustand58.9kLibrarybeginner15 days agoReact developers who want simpler shared state than Redux
redux-toolkit11.2kLibraryintermediate4 days agoDevelopers already using or learning Redux for app state
valtio10.2kLibraryintermediate7 days agoReact developers who want simple shared state without a lot of boilerplate
xstate30.4kLibraryintermediate4 days agoFrontend developers managing complex UI flows with many interacting states

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.