Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / store / defineStore

Function: defineStore()

defineStore(initial): void

Defined in: flow/src/store.ts:94

Declare (or extend) the client store's initial shape — call once at app start:

// resources/js/app.ts — import from the browser-safe /store subpath, not the package barrel.
import { defineStore } from "@zerotal/flow/store";
defineStore({ ui: { dark: false, sidebar: true }, cart: { count: 0 } });

Existing values are preserved (defaults only). Safe to call before OR after the Flow runtime boots — a call made before Alpine exists is queued and applied when the store is registered.

Parameters

initial

Record<string, unknown>

Returns

void