@delpi/zen-state
v1.0.0
Published
State management library for Zen. Supports reactive stores and computed values.
Readme
@delpi/zen-state
State management library for Zen. Supports reactive stores and computed values.
LIVE DEMO
Installation
npm install @delpi/zen-state
# or
pnpm add @delpi/zen-stateUsage
import { createStore, computed } from '@delpi/zen-state';
// Create store
const counterStore = createStore({ count: 0 });
counterStore.subscribe(state => console.log('State changed:', state));
// Update store
counterStore.set({ count: 1 });
// Computed example
const doubleCount = computed([counterStore], () => counterStore.get().count * 2);
doubleCount.subscribe(() => console.log('Double count changed:', doubleCount.get()));
License
MIT
