ilokesto

State

@ilokesto/state connects @ilokesto/store to framework lifecycles. It gives each framework a small create() adapter while keeping the underlying state model framework-neutral.

import { create } from '@ilokesto/state/react';

const useCounter = create({ count: 0 });

function Counter() {
  const [count, setCounter] = useCounter((state) => state.count);
  return <button onClick={() => setCounter((state) => ({ count: state.count + 1 }))}>{count}</button>;
}

Use this package when you want one small store model with adapter-specific return shapes for React, Vue, Svelte, Solid, or Angular.

Install

npm install @ilokesto/state

Install the framework peer you use, such as react, vue, svelte, solid-js, or @angular/core. Install immer only when you use adaptor from @ilokesto/state/utils.

What this package is not

  • It is not a generated API reference.
  • It is not a framework tutorial.
  • It does not change @ilokesto/store; it wraps a Store<T> or creates one from an initial value.
  • The root package is package identity today. Runtime APIs are imported from subpaths such as @ilokesto/state/react.

Where to start

  • Start with Quick start.
  • Learn the model in Core concepts.
  • Pick your adapter under Integrations: React, Vue, Svelte, Solid, or Angular.
  • Use Middleware and Utility when you need logging, validation, persistence, composition, or Immer-style updates.

On this page