JO

Jotai Scope

jotai-scope

πŸ‘»πŸ”­

State Management
jotai
react
scope
jotai-scope
State Management
javascript
npm
frontend
open source
ui
Stars
87
Weekly
1.6M
Open issues
4
Bundle
~25 kB

Installation

npm install jotai-scope

Code example

import { create } from "jotai-scope";

const useStore = create((set) => ({
  count: 0,
  inc: () => set((s) => ({ count: s.count + 1 })),
}));

export function Example() {
  const { count, inc } = useStore();
  return (
    <button type="button" onClick={inc}>
      Count: {count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Daishi Kato
  • 1.6M 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
  • 4 open issues on GitHub

FAQs

Alternatives & similar libraries