JO

Jotai

jotai

👻 Primitive and flexible state management for React

State Management
react
state
manager
management
recoil
store
jotai
State Management
javascript
npm
Stars
21k
Weekly
3.8M
Open issues
2
Bundle
~25 kB

Installation

npm install jotai

Code example

import { atom, useAtom } from "jotai";

const countAtom = atom(0);

export function Example() {
  const [count, setCount] = useAtom(countAtom);
  return (
    <button type="button" onClick={() => setCount((c) => c + 1)}>
      Count: {count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Daishi Kato
  • 3.8M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 2 open issues on GitHub

FAQs

Alternatives & similar libraries