Overview

Jotai is a state management library for React applications, introduced in 2020, that emphasizes a minimalistic and atom-based approach. The name "Jotai" is derived from the Japanese word for "state" (状態) and reflects its core philosophy of managing state through granular, independent units called atoms. This design departs from more centralized store patterns, allowing developers to define state in a declarative manner, where each piece of state, or atom, can be read from or written to directly by components.

The library is designed for developers seeking a flexible and performant solution for managing local and global state within React applications. Its fine-grained update mechanism means that components only re-render when the specific atoms they subscribe to change, which can contribute to optimizing rendering performance, particularly in complex applications with frequently updated state. Jotai's API is concise, aiming to reduce boilerplate code associated with state management, and it offers robust TypeScript support, enhancing developer experience through type safety and autocompletion.

Jotai is particularly well-suited for applications where performance is a critical consideration and for projects that benefit from a modular state structure. Its flexibility allows it to be scaled from small components to large, application-wide state. Developers familiar with React hooks will find Jotai's API intuitive, as it leverages similar patterns for defining and interacting with state. It supports various use cases, from simple UI state to complex asynchronous data fetching, and provides utilities for derived state, read-only atoms, and various integrations with React's concurrent features. The open-source nature of Jotai means it is entirely free to use and benefits from community contributions and ongoing development.

While Jotai provides core state management functionality, it also offers a range of utility packages for specific needs, such as integrating with React Query for server state management, enabling persistence for client-side storage, or working with React Native applications. This ecosystem allows developers to extend Jotai's capabilities without introducing unnecessary complexity into the core library. The library's approach to state management aligns with modern React paradigms, emphasizing hooks and functional components, making it a viable option for contemporary web development projects seeking an efficient and developer-friendly state solution.

Key features

  • Atom-based state model: State is broken down into small, independent units called atoms, which can be combined to form more complex state, promoting modularity and reusability, as described in the Jotai getting started guide.
  • Fine-grained updates: Components only re-render when the specific atoms they subscribe to change, rather than the entire global state, potentially improving application performance.
  • Minimalistic API: Jotai provides a small API surface area, reducing the learning curve and boilerplate code compared to more comprehensive state management solutions.
  • TypeScript support: Built with TypeScript, Jotai offers strong type inference and safety, which can enhance developer experience and reduce runtime errors.
  • Derived state: Create computed state from existing atoms, allowing for complex data transformations and dependencies.
  • Asynchronous state management: Supports asynchronous operations within atoms, facilitating data fetching and other side effects.
  • Developer experience: Leverages React hooks internally, making its usage intuitive for developers familiar with modern React patterns.
  • Ecosystem of utilities: Extensible with official and community-contributed utility packages for persistence, server state, devtools, and more, detailed in the Jotai API documentation.

Pricing

As of May 7, 2026, Jotai is an open-source project distributed under the MIT License. This means it is entirely free to use for both personal and commercial projects. There are no licensing fees, subscription costs, or premium features requiring payment. Contributions to the project's development are welcomed through its GitHub repository.

Feature Description Availability
Core Library Atom-based state management, fine-grained updates, TypeScript support Free
Utility Packages Persistence, server state integration, devtools, etc. Free
Community Support Discord, GitHub Discussions Free
Commercial Use Use in proprietary applications Free

Common integrations

  • React Query: Jotai can integrate with React Query for managing server-side state, offering tools to bridge client and server data. Refer to the Jotai React Query integration guide for specific examples.
  • Next.js: Jotai works with Next.js for server-side rendering (SSR), static site generation (SSG), and client-side rendering. The Next.js documentation provides context on integrating state management in React frameworks.
  • Vite: Compatible with Vite for fast development server and build optimizations. Developers can use Jotai in Vite-powered React projects without additional configuration.
  • React Native: Jotai supports React Native applications, enabling developers to use the same state management patterns across web and mobile platforms, as noted in the React Native getting started guide.
  • Immer: Can be used alongside Immer for immutable state updates with mutable syntax, simplifying complex state transformations.
  • Redux DevTools: Jotai offers an integration with Redux DevTools for debugging state changes and time-travel debugging. The Jotai DevTools documentation outlines setup.

Alternatives

  • Zustand: A minimalistic state management solution similar to Jotai, also focusing on simplicity and hooks-based API, but often described as a more traditional store-based approach.
  • Recoil: Developed by Meta, Recoil also uses an atom-based model for state management in React, providing a similar conceptual framework to Jotai with a different API design.
  • Redux: A widely adopted state management library for JavaScript applications, known for its centralized store, strict immutability, and extensive ecosystem, offering a more opinionated and structured approach.
  • React Context API: React's built-in solution for passing data through the component tree without prop drilling, suitable for less frequent updates or simpler global state requirements.
  • React useState/useReducer: Core React hooks for local component state management, often used in conjunction with other libraries for global state, but can manage simple global state with Context.

Getting started

To begin using Jotai in a React project, you typically install it via npm or yarn. After installation, you can define atoms and consume them within your React components using the useAtom hook. The following example demonstrates how to create a simple counter application with Jotai, defining a count atom and functions to increment and decrement its value.

// src/atoms.ts
import { atom } from 'jotai';

export const countAtom = atom(0); // Define an atom with an initial value of 0
export const incrementAtom = atom(
  (get) => get(countAtom),
  (get, set) => set(countAtom, get(countAtom) + 1)
); // Derived atom to increment count
export const decrementAtom = atom(
  (get) => get(countAtom),
  (get, set) => set(countAtom, get(countAtom) - 1)
); // Derived atom to decrement count
// src/App.tsx
import React from 'react';
import { useAtom } from 'jotai';
import { countAtom, incrementAtom, decrementAtom } from './atoms';

function Counter() {
  const [count] = useAtom(countAtom); // Read the count atom
  const [, increment] = useAtom(incrementAtom); // Get the increment function
  const [, decrement] = useAtom(decrementAtom); // Get the decrement function

  return (
    <div>
      <h1>Count: {count}</h1>
      <button onClick={increment}>Increment</button>
      <button onClick={decrement}>Decrement</button>
    </div>
  );
}

function App() {
  return (
    <div className="App">
      <h2>Jotai Counter Example</h2>
      <Counter />
    </div>
  );
}

export default App;

This example sets up three atoms: countAtom for the current value, and incrementAtom and decrementAtom as write-only atoms that modify countAtom. In the Counter component, useAtom is used to access the current count and the functions to change it. This structure demonstrates Jotai's approach to local and derived state, promoting separation of concerns and reusability of state logic.