
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A lightweight, efficient state management solution for React with zero dependencies beyond React itself. Storio gives you the simplicity of Zustand with the predictability of useSyncExternalStore, without providers, contexts, or boilerplate.
Why choose Storio over Zustand or Redux?
npm install storio
# or
pnpm add storio
# or
yarn add storio
Here's a simple counter example that demonstrates the basic usage of Storio:
import { create } from 'storio';
// Create a store with initial state and actions
const useCounter = create((set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 })),
decrement: () => set((state) => ({ count: state.count - 1 }))
}));
// Use the store in your component
function Counter() {
const {count} = useCounter();
const { increment, decrement } = useCounter();
return (
<div>
<button onClick={decrement}>-</button>
<span>{count}</span>
<button onClick={increment}>+</button>
</div>
);
}
Storio supports more complex state patterns with custom selectors and computed values. Here's an example of a responsive dimensions store:
import { create } from 'storio';
export const dimensionsStore = create((set) => ({
vw: 0,
setVw: (width) => set({ vw: width }),
// Computed values using store state
isMobile: () => {
const { vw } = dimensionsStore.getState();
return vw <= 480;
},
isTablet: () => {
const { vw } = dimensionsStore.getState();
return vw > 480 && vw <= 1024;
},
isDesktop: () => {
const { vw } = dimensionsStore.getState();
return vw >= 1024;
}
}));
// Usage in components
function ResponsiveComponent() {
const { isMobile } = dimensionsStore();
return (
<div>
{ isMobile() ? 'Mobile View' : 'Desktop View' }
</div>
);
}
Pattern: Expose computed helpers on the store and destructure them in components for clarity and reuse. Alternatively, you can select primitives with a selector if you prefer returning a boolean directly.
| Criteria | Storio | Zustand | Redux Toolkit |
|---|---|---|---|
| Provider required | No | No | Yes (<Provider>) |
| Dependencies | React peer only | zustand | @reduxjs/toolkit, react-redux |
| API surface | Tiny | Small | Larger |
| Boilerplate | None | Low | Medium |
| Selective re-render | Yes (selector) | Yes (selector) | Yes (useSelector) |
| Equality logic | Deep equality built-in | Shallow/ref equality by default | Custom via useSelector |
| DevTools | Manual integration | Via middleware | Built-in DevTools |
| Middleware | Not needed for basics | Optional addons | First-class |
| SSR-safe | Yes (useSyncExternalStore) | Yes | Yes |
| Learning curve | Very low | Low | Medium |
If you want the smallest, most readable solution without sacrificing control, Storio is a great fit. If you need time‑travel debugging or a middleware ecosystem out‑of‑the‑box, Redux Toolkit remains excellent.
Storio is built with performance in mind:
create(storeCreator)Creates a new store with the given initial state and actions.
storeCreator: function that receives (set, get) and returns the initial state and actionsThe created hook provides several features:
const value = useStore((state) => state.value)const { setValue } = useStore()useStore.getState()useStore.setState(nextOrUpdater)useStore.subscribe(listener)SSR: Storio uses useSyncExternalStore under the hood, providing correct server and client semantics without extra configuration.
Most stores migrate by changing the import. If your store only uses set, it’s a pure drop‑in.
// Before
import { create } from 'zustand';
const useCounter = create((set) => ({
count: 0,
increment: () => set((s) => ({ count: s.count + 1 })),
}));
// After
import { create } from 'storio';
const useCounter = create((set) => ({
count: 0,
increment: () => set((s) => ({ count: s.count + 1 })),
}));
If you used Zustand’s get, Storio exposes it as the second argument to create((set, get) => ...) and also via useStore.getState().
Replace slices and reducers with a small store and explicit actions. No provider needed.
// Instead of slice + reducers
import { create } from 'storio';
export const useTodos = create((set, get) => ({
items: [],
add: (title) => set((s) => ({ items: [...s.items, { id: Date.now(), title }] })),
remove: (id) => set((s) => ({ items: s.items.filter((t) => t.id !== id) })),
}));
function TodoList() {
const items = useTodos((s) => s.items);
const { add, remove } = useTodos();
// ...
}
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
FAQs
A simple React store provider
We found that storio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.