dawei
Minimal, flexible state management for React.
dawei is a tiny but powerful state management library for React. Inspired by Zustand and Recoil, it provides a simple API that works without context—while still supporting deeply nested values, subscriptions, and scoped stores. It’s built for projects that want fine-grained control without boilerplate.
Links:
What it does
-
Minimal API
No providers, no reducers, no boilerplate—justcreateStore()andstore.use(). -
Deep state access
Read and write nested keys like
company.name, even if parts of the path don’t exist yet. -
Global reactivity
Components stay in sync automatically. No selector ceremony or memo gymnastics. -
Direct control
Update from anywhere with
store.set()and listen withstore.subscribe().
Installation
npm install dawei
or
yarn add dawei
Usage
import { createStore } from "dawei";
const formStore = createStore({});
const Input = () => {
const [name, setName] = formStore.use("name");
const [email, setEmail] = formStore.use("email");
const [companyName, setCompanyName] = formStore.use("company.name");
return (
<form>
<input value={name} onChange={(e) => setName(e.target.value)} />
<input value={email} onChange={(e) => setEmail(e.target.value)} />
<input
value={companyName}
onChange={(e) => setCompanyName(e.target.value)}
/>
</form>
);
};
function randomBitOfApi() {
formStore.set({ saved: true });
}
const unsubscribe = formStore.subscribe((state) => {
console.log("formStore changed", state);
});
Notes
- Concurrent React: use dawei >= 0.14.0. Earlier versions can fail due to how
forceUpdatewas implemented. - The API has stabilized and is expected to avoid breaking changes going forward—version
1.0.0would make sense once that stability has held for a while.
Why it exists
React state patterns often drift toward either heavy ceremony (context + reducers) or brittle homegrown stores. dawei aims for the sweet spot: a tiny API with practical ergonomics, predictable behavior, and enough power to model real app state without bringing in a whole framework.
“Dawei gives us the store behavior we want — without the noise.” — The Sparkstone Team
This remind you of a problem you've been dealing with?
I'd be happy to discuss it with you and see if it's something we could turn into a solution.
Book a call