Installation#

@sigx/store builds on the SignalX reactive core, so it is designed to be used inside a project that already renders SignalX components with the sigx package.

Install#

Terminal
pnpm add @sigx/store

The package is ESM-only and ships two entry points:

  • @sigx/storedefineStore, storeToSignals, onStoreCreated, and their supporting types.
  • @sigx/store/persist — the persist composable and its types (see Persistence).

Dependencies#

@sigx/store builds on the reactive core but never bundles its own copy — it always uses the same core your components do. This matters because core keeps process-wide singletons: the topic registry, the DI app-context token, instanceof identity. A second, separate copy would silently split that shared state.

You don't install core separately, though. The sigx umbrella your app already runs on bundles @sigx/reactivity and @sigx/runtime-core, so npm install @sigx/store above is all you add — sigx provides component, render, signal, and computed, and @sigx/store adds defineStore on top. (Starting from scratch? Install sigx first — see Project setup below.)

Project setup#

No special Vite or build configuration is required beyond a standard SignalX + TSX/JSX setup. If your project already renders SignalX components, you can import and use defineStore immediately:

TypeScript
import { defineStore } from '@sigx/store';

If you are setting up a SignalX project from scratch, follow Core → Installation for the JSX/TSX and Vite configuration, then add @sigx/store on top.

Verify#

Define a tiny store and read it in a component to confirm everything is wired up:

TSX
import { component, render } from 'sigx';
import { defineStore } from '@sigx/store';

const usePing = defineStore('ping', ({ defineState }) => {
    const { signals } = defineState({ message: 'store is working' });
    return { ...signals };
});

const App = component(() => {
    const store = usePing();
    return () => <p>{store.message}</p>;
});

render(<App />, '#app');

Next steps#