Skip to content

ZhuàngTài State

Simple, direct state primitives for JavaScript. Manage state with small, synchronous, predictable primitives without hidden scheduling in the core.

Synchronous by default

set() updates immediately and watch() runs synchronously. There is no hidden batching or delayed scheduling.

Zero-dependency core

@zhuangtai-js/core has no third-party runtime dependencies and keeps the core API small.

Composable plugins

Install plugins with createAtom(). The default atom() export stays clean and unextended.

TypeScript first

Written in TypeScript natively, providing complete type inference and type safety.

Start with one minimal Core path, then choose the quick start that matches your UI boundary. The homepage keeps this copy-ready snippet static and does not load any framework runtime.

import { atom } from "@zhuangtai-js/core";
const count = atom(0);
count.set((value) => value + 1);

Install

Install the core package:

Terminal window
pnpm add @zhuangtai-js/core

Install plugins like persistence or React adapter only when you need them:

Terminal window
pnpm add @zhuangtai-js/core @zhuangtai-js/persist @zhuangtai-js/react

Ready to get started?

Read the getting started guide, or check out the source code on GitHub.