Skip to main content
Experimental

Duck State

Atom-based state management for React — Jotai-inspired primitives, auto dependency tracking, derived atoms, and a standalone store.

Atom-based

Small atoms, predictable state

Duck State is a Jotai-inspired state primitive. Atoms hold values, derived atoms compute, and the store subscribes — no boilerplate in between.

Atom-based

Create primitive, derived, or writable-derived atoms. State is a graph of atoms — simple to read, easy to reason about.

Auto dependency tracking

Derived atoms subscribe to their reads. No selectors, no dependency arrays — change propagates where it should.

Standalone store

`createStore()` works outside React. Read, write, subscribe — use it in workers, tests, or any JS environment.

React bindings

`useAtom`, `useAtomValue`, `useSetAtom`, `useStore`, and a `<Provider>` — familiar Jotai-style API.

Writable derived

Derive for read, inject a setter for write. Keep computed state in one place without scattering update logic.

Jotai-inspired, tiny

Same mental model, lean surface area. No boilerplate, no middleware registry, no provider soup.

Quick setup

One install. Use the standalone store or the React bindings — both ship from the same package.

# Install
bun add @gentleduck/state

# Create 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.

Become a Sponsor