BASE

Jotai

Jotai

UI library · Free

Atomic state management for React: organizes independent and derived values into small subscribable atoms.

Also known as: pmndrs/jotai; jotai; jotai-state; react-jotai

Resource illustration: Jotai

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Connect independent and derived values in React
  • Connect reading and updating atoms to workflow components

Example workflow

A possible workflow; this is not a report of hands-on testing.

Connect independent and derived values in React.

Before you start

  • The component's design, states, and data.
  • A compatible framework and the project's styles.

Steps

  1. Define atoms for source data and computed values.
  2. Connect reading and updating atoms to workflow components.
  3. Configure styles and check empty, loading, and error states.

Check your result

  • The keyboard, focus indicators, and a screen reader let users complete the action.
  • The component works on a narrow screen and with long data values.

Choosing Jotai

Connect independent and derived values in React

Choose this when

  • Connect independent and derived values in React
  • Connect reading and updating atoms to workflow components

Consider alternatives when

  • When choosing for this topic, compare Jotai with Immer. A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.
  • When choosing for this topic, compare Jotai with Valtio. A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

Requirements

  • When creating an atom inside render, preserve its identity through useMemo or useRef if it is passed to useAtom.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for the code; dependencies have separate licenses.
  • A new atom on every render can cause an infinite useAtom loop; atom configuration and its value are separate entities.

Frequently asked questions

What can you use for free in Jotai?

Code and local use under MIT.

What additional costs might arise with Jotai?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for Jotai?

MIT for the code; dependencies have separate licenses.

How do you get started with Jotai?

Define atoms for source data and computed values. Connect reading and updating atoms to workflow components. Configure styles and check empty, loading, and error states.

Why can creating an atom inside a component cause a loop?

The documentation requires a stable reference identity for an atom. Its immutable configuration does not itself contain the value: the value is stored in the store. Use useMemo/useRef or a persistent atom outside render where appropriate for the task.

Related tasks and approaches

  • Immer

    A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

  • Valtio

    A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

  • Zustand

    A candidate to compare under the topic: Design systems, UI components. This is an editorial connection by topic, not a confirmed alternative or a guarantee that the products work together.

License

MIT for the code; dependencies have separate licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • Jotai
  • UI
  • Development

Sources

Other resources