Introduction to Jotai
Jotai is a primitive and flexible state management library for React. It scales from a simpleuseState replacement to an enterprise TypeScript application with minimal core API footprint.
What is Jotai?
Jotai takes an atomic approach to global React state management with a bottom-up approach. You define small, independent pieces of state (atoms) and compose them together. This gives you maximum flexibility while keeping your code simple and maintainable.
Key Features
Minimal Core
Just 2kb core bundle size. No boilerplate, no configuration required.
TypeScript First
Built with TypeScript from the ground up with full type safety.
No String Keys
Unlike Recoil, atoms are defined by reference, not by string keys.
React Suspense
Native support for async atoms and React Suspense out of the box.
Quick Example
Here’s a simple counter to show how Jotai works:Core Concepts
Jotai is built around a few simple concepts:Atoms
Atoms are units of state. You can think of them as individual pieces of state that can be read and written to.Derived Atoms
Derived atoms compute their value from other atoms:Writable Derived Atoms
You can also create atoms that derive their value but can be written to:Next Steps
Quickstart
Get up and running with Jotai in 5 minutes
Core Concepts
Learn about atoms, derived state, and async patterns
API Reference
Complete API documentation for all Jotai functions
Guides
Patterns and best practices for common use cases
Why Jotai?
Simple and Flexible
Simple and Flexible
Jotai’s API surface is tiny - just
atom and a few hooks. But don’t let that fool you - you can build complex state management with these simple primitives. There’s no configuration, no boilerplate, and no magic.Performance by Default
Performance by Default
Jotai only re-renders components that actually use the atoms that changed. No manual optimization needed - it’s fast out of the box.
TypeScript Native
TypeScript Native
Jotai is written in TypeScript and provides excellent type inference. Your atoms will be fully typed without any extra work.
Async Made Easy
Async Made Easy
Async state is a first-class citizen in Jotai. Just make your atom read function async and Jotai handles the rest with React Suspense.
Testable
Testable
Because atoms are just plain objects and don’t require providers, testing is straightforward. No complex setup needed.