Skip to main content

Installation

Get started with Jotai by installing it in your React project.

Requirements

Minimum Requirements

  • React: 17.0.0 or higher
  • Node.js: 12.20.0 or higher
  • TypeScript: 3.8 or higher (optional but recommended)

Install Jotai

Choose your preferred package manager:
npm install jotai
That’s it! No additional configuration or setup required.

TypeScript Support

Jotai is written in TypeScript and includes full type definitions out of the box. No need to install separate @types packages.
Jotai requires TypeScript 3.8 or higher for full type support. The library provides excellent type inference, so your atoms will be fully typed automatically.

TypeScript Version Support

Jotai provides different type definitions based on your TypeScript version:
  • TypeScript 4.8+: Full features with latest type improvements
  • TypeScript 3.8+: Full compatibility with stable types
  • TypeScript < 3.8: Not supported

Importing Jotai

Once installed, you can import from the main package:

Core Functions

import { atom, useAtom, useAtomValue, useSetAtom } from 'jotai'

Utility Functions

Jotai provides many utilities for common patterns:
import { atomWithStorage, atomFamily, selectAtom } from 'jotai/utils'
The utilities are in a separate import path (jotai/utils) to keep the core bundle size minimal. Import utilities only when you need them.

Package Exports

Jotai uses modern package exports with support for different module systems:
{
  "jotai": "Main package with core functions",
  "jotai/utils": "Utility functions and atoms",
  "jotai/vanilla": "Vanilla (non-React) atoms",
  "jotai/vanilla/utils": "Vanilla utility functions",
  "jotai/react": "React-specific hooks",
  "jotai/react/utils": "React utility hooks"
}

ESM and CJS Support

Jotai supports both ES modules and CommonJS:
  • ESM: Modern import/export syntax (recommended)
  • CommonJS: Node.js require syntax
  • React Native: Optimized bundle for React Native
The correct version is automatically selected based on your build environment.

Bundle Size

Core Package

~2kb minified and gzipped

With Utils

Import utilities as needed - tree-shakeable
Jotai’s core is intentionally minimal. Utilities are separate, so you only bundle what you use.

Next Steps

Ready to Start?

Follow our quickstart guide to build your first Jotai app in 5 minutes.

Troubleshooting

If you see TypeScript errors, make sure you’re using TypeScript 3.8 or higher. You can check your version with:
npx tsc --version
Upgrade TypeScript if needed:
npm install -D typescript@latest
If you get “Module not found” errors, ensure:
  1. You’ve installed the package: npm install jotai
  2. Your bundler supports package exports (most modern bundlers do)
  3. You’re importing from the correct path: jotai or jotai/utils
Jotai requires React 17.0.0 or higher. Check your React version:
npm list react
Upgrade React if needed:
npm install react@latest react-dom@latest

Build docs developers (and LLMs) love