Documentation Index
Fetch the complete documentation index at: https://mintlify.com/christianbaroni/stores/llms.txt
Use this file to discover all available pages before exploring further.
createStoreActions inspects a store’s current state, collects every function-typed property, and returns them as a plain stable object. This lets you import and call store actions without importing the full store hook — and without accidentally triggering React re-renders from module-level code.
Signatures
Parameters
The store instance whose function-typed state properties will be extracted.
Pass the store reference directly (e.g. the value returned by
createBaseStore).An optional object of additional methods to merge into the returned actions
object. The keys of
bundledMethods must not overlap with any key already
present in the store’s state — TypeScript enforces this constraint at
compile time via the NoOverlap utility type.Return value
A plain object containing every function-typed key from the store’s state
type. Formally defined as:When
bundledMethods is provided the return type is StoreActions<Store> & Bundled.Usage pattern
Export the store and its actions from the same file. Components subscribe through the store; imperative code (event handlers, utilities, other stores) calls actions directly.Adding bundled methods
UsebundledMethods to co-locate related helpers that are not part of the store state itself:
Virtual store behaviour
For virtual stores (created withcreateVirtualStore), each action returned by createStoreActions is a delegating wrapper — every call is forwarded to the method on the current underlying store at call time. This ensures that when the virtual store’s target changes, action calls are automatically routed to the new target.