Welcome to Unistash
Write once. Stash anywhere.
Unistash
Write once. Stash anywhere.
Universal state management abstraction for React. Write your state management code once, run it with any library.
Quick Start
npm install @unistash/zustand
# or @unistash/jotai, @unistash/redux, etc.import { createStore } from '@unistash/zustand';
const useCounterStore = createStore({
state: { count: 0 },
actions: {
increment: (state) => ({ count: state.count + 1 }),
},
computed: {
doubled: (state) => state.count * 2,
}
});
function Counter() {
const { count, doubled, actions } = useCounterStore();
return (
Count: {count} (Doubled: {doubled})
+
);
}Available Adapters
-
@unistash/zustand - Zustand adapter
- Small bundle size
- No provider needed
- Simple and fast
-
@unistash/jotai - Jotai adapter
- Atomic state management
- React 18 optimized
- Fine-grained updates
-
@unistash/redux - Redux Toolkit adapter
- Enterprise-ready
- Redux DevTools
- Rich middleware ecosystem
-
🚧 @unistash/valtio - Coming soon
-
🚧 @unistash/recoil - Coming soon
-
🚧 @unistash/mobx - Coming soon
Why Unistash?
Switch Libraries Instantly
Change one import, keep your code. No rewrites needed.
// Before
import { createStore } from "@unistash/zustand";
// After - just change the import!
import { createStore } from "@unistash/redux";
// Everything else stays the sameLearn Once, Use Everywhere
One API for all state libraries. Master Unistash, use any adapter.
Zero Vendor Lock-in
Never get stuck with a single state library again. Your code is portable.
Perfect for Open Source
Contributors can work with any project using Unistash, regardless of the underlying library.
Type-Safe
Full TypeScript support with excellent type inference across all adapters.
How It Works
Unistash provides a universal API that adapts to different state management libraries:
Your Code (Unistash API)
↓
Adapter Layer
↙ ↓ ↘
Zustand Jotai ReduxYou write code once using Unistash's API. The adapter translates it to work with your chosen library under the hood.
Philosophy
State management libraries are tools, not religions. Different projects have different needs:
- Startups might prefer Zustand for speed
- Enterprises might need Redux for debugging
- Teams might want Jotai for React 18 features
Unistash lets you choose the right tool without rewriting your application.
Comparison
| Feature | Unistash + Zustand | Unistash + Redux | Pure Zustand | Pure Redux |
|---|---|---|---|---|
| Bundle size | Small | Medium | Small | Medium |
| Learning curve | Easy | Easy | Easy | Hard |
| Vendor lock-in | None | None | High | High |
| DevTools | Optional | Built-in | Optional | Built-in |
| Portability | ✅ High | ✅ High | ❌ Low | ❌ Low |