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: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
Utility Functions
Jotai provides many utilities for common patterns: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: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
Bundle Size
Core Package
~2kb minified and gzipped
With Utils
Import utilities as needed - tree-shakeable
Next Steps
Ready to Start?
Follow our quickstart guide to build your first Jotai app in 5 minutes.
Troubleshooting
TypeScript errors about version
TypeScript errors about version
If you see TypeScript errors, make sure you’re using TypeScript 3.8 or higher. You can check your version with:Upgrade TypeScript if needed:
Module not found errors
Module not found errors
If you get “Module not found” errors, ensure:
- You’ve installed the package:
npm install jotai - Your bundler supports package exports (most modern bundlers do)
- You’re importing from the correct path:
jotaiorjotai/utils
React version compatibility
React version compatibility
Jotai requires React 17.0.0 or higher. Check your React version:Upgrade React if needed: