Introduction
A routing guide for the framework neutral Store package.
Store
@ilokesto/store stores one TypeScript state value, replaces it through setState, and notifies subscribers after successful replacements.
The contract stays framework neutral so React, Vue, Svelte, Angular, and other runtimes can connect through adapters instead of owning the core state layer.
Package boundary
The package exports Store<T> from @ilokesto/store.
What it covers:
- one stored state value,
- reads for current and initial state,
- replacement updates with a value or updater function,
- subscriptions for successful state changes,
- source backed middleware through current public method names.
What it does not cover:
- framework hooks,
- selectors or reducers,
- persistence or data fetching,
- devtools,
- async scheduling.
Install
npm install @ilokesto/storeStart here
- Quick Start: Install and wire a first store.
- Core Concepts: Understand snapshots and replacement updates.
- API Reference: Check the public
Store<T>surface.
Continue with task focused pages
- Framework Usage: Connect framework lifecycles.
- Common Patterns: Apply plain
Storerecipes. - Advanced Semantics: Review update and notification rules.
- Building on Store: Build adapters on the minimal contract.
- Troubleshooting: Diagnose common usage mistakes.
Small example
import { Store } from "@ilokesto/store";
const counterStore = new Store({ count: 0 });
const unsubscribe = counterStore.subscribe(() => {
console.log(counterStore.getState());
});
counterStore.setState((prev) => ({ ...prev, count: prev.count + 1 }));
unsubscribe();