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
pnpm add @sigx/storeThe package is ESM-only and ships two entry points:
@sigx/store—defineStore,storeToSignals,onStoreCreated, and their supporting types.@sigx/store/persist— thepersistcomposable 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:
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:
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
- Getting Started — the core mental model with live examples.
- Defining a Store — state, actions, derived values, and events.
- Using Stores in Components — sharing, lifetimes, and cleanup.
