State as a graph of atoms
Atom-based state for React, inspired by Jotai. Derived atoms track their own dependencies, and the store works outside React too.
Atoms
Create primitive, derived, or writable derived atoms. Your state becomes a graph you can read and reason about.
Automatic tracking
Derived atoms subscribe to whatever they read. No selectors and no dependency arrays.
Standalone store
createStore()works outside React. Read, write, and subscribe from workers, tests, or any JavaScript runtime.React bindings
useAtom,useAtomValue,useSetAtom,useStore, and a<Provider>. If you know Jotai, you know the API.Writable derived atoms
Derive a value for reads and add a setter for writes. Computed state and its update logic stay in one place.
Small surface
The Jotai mental model with less API. No boilerplate, no middleware registry, and no nested providers.
Install
One package covers the standalone store and the React bindings.
Install
bun add @gentleduck/stateCreate an atom
import { atom, createStore } from '@gentleduck/state'
Free & open source
gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.