0PricingLogin
React Academy · Lesson

Atoms: The Unit of State in Jotai

Create primitive atoms with atom() and understand how Jotai's Provider-less design differs from Context.

What is an Atom?

In Jotai, state is broken into atoms: small, independent pieces of reactive state. Each atom holds a single value and is created outside of components with atom(initialValue).

This mirrors the mental model of splitting state into the smallest meaningful units, rather than one large store object.

Atoms are Reactive

When an atom's value changes, only the components that subscribed to that specific atom re-render. Components that read other atoms are unaffected.

This fine-grained reactivity is Jotai's core advantage over React Context, which re-renders all consumers on any change.

All lessons in this course

  1. Atoms: The Unit of State in Jotai
  2. Reading and Writing Atoms with useAtom
  3. Derived Atoms and Async Atoms
  4. Jotai vs Zustand vs Context: When to Use Which
← Back to React Academy