ilokesto

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/store

Start here

Continue with task focused pages

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();

On this page