Synchronous by default
set() updates immediately and watch() runs synchronously. There is no hidden batching or
delayed scheduling.
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);React
Subscribe to atoms with React hooks while keeping the state module outside components.
Preact
Connect the same Core state model with lightweight Preact hooks.
Vue
Use effect scopes to manage Vue reads and cleanup inside components.
Svelte
Convert atoms to standard Svelte readable or writable stores.
Solid
Connect Solid with accessors, setters, and owner lifecycle cleanup.
React Native / Expo
Expo uses the React adapter; the app can pass its own PromiseLike storage to Persist.
Install
Install the core package:
pnpm add @zhuangtai-js/coreInstall plugins like persistence or React adapter only when you need them:
pnpm add @zhuangtai-js/core @zhuangtai-js/persist @zhuangtai-js/reactRead the getting started guide, or check out the source code on GitHub.