ZenBox

2025-07Packages

React state management that feels like Vue vibes in React
查看源码

什么是 ZenBox?

ZenBox 是一个现代化的 React 状态管理库,它将 Zustand 的简洁与 Vue 的响应式写法完美结合。

用起来既简单又符合直觉,让你写 React 像写 Vue 一样爽!

如果你喜欢 Zustand 和 Vue,你一定会喜欢 ZenBox!

🐻 像 Zustand 一样简单

const counter = createStore({ count: 0 }); // 自动类型推导,无需手写 interface

💚 像 Vue 一样熟悉的写法

const doubled = useComputed(() => counter.value.count * 2);

useWatch(
  () => counter.value.count,
  (current, prev) => console.log("从", prev, "变为", current)
);

核心特性

Zenbox vs Zustand

FeatureZenBoxZustand
Learning Curve✅ As easy as Vue✅ Low
Vue-like HooksuseComputed / useWatch❌ Not supported
TypeScript✅ Auto-inference⚠️ Manual interfaces
Cross-Store✅ Auto tracking❌ Not supported
State Access✅ Unified store.value⚠️ Explicit get() / set()
Scoping✅ Built-in Provider❌ Global by default
Immer✅ Built-in⚠️ Middleware required
Bundle Size< 3KB gzipped (without Immer)< 1KB gzipped