react/store
Use @themislib/themis/react-store for ReactStore imports, init/dispose, and runSaga/dispatch/state behavior. Defer app wiring and selector call modes to their React owners.
SKILL.mdskills/react/store/SKILL.md
GitHubReactStore import and lifecycle
Use this skill when a task needs the React signal Store variant. For shared state
policy, reducers, actions, sagas, and package import boundaries, also follow the
matching core/* skills.
Correct import and class choice
- Use
ReactStorefrom@themislib/themis/react-store. - Do not import React selector internals from
src/*orutils/react-selectors/*.
import { ReactStore } from "@themislib/themis/react-store";
export const reactStore = new ReactStore({ todos: todosReducer });
const dispose = reactStore.init();
Lifecycle rules
This is a runtime API summary. Bootstrap, init/dispose ownership, and app saga startup procedures belong to Create and configure ReactStore and its lifecycle sections. Consumer call-mode decisions belong to Call-mode map.
- Construct
ReactStorewith app-owned reducers and optional middleware, then callreactStore.init(initialState?)before invoking direct selector calls or.useValue(...args). - React selector calls return Preact React signal outputs backed by the Store-owned
state stream after initialization and throw before
init()or afterdispose(). - Keep app shared/domain state in reducers and ReactStore selectors rather than module-level shared Preact signals.
reactStore.dispatch,reactStore.state,reactStore.runSaga(sagaFn), andreactStore.dispose()follow the shared Store runtime behavior documented in@themislib/themis/docs/ARCHITECTURE.md; saga runtime mechanics are in Store saga lifecycle.- Do not manually register package-owned
@internal_reducers or internal sagas.
Verification cues
- Imports use
@themislib/themis/react-storeforReactStore. - React examples initialize the Store before signal selector reads.
- The app path uses only the public ReactStore runtime and React signal selectors.