API reference@evolu/commonStore › createStore

function createStore<T>(initialState: T, eq?: Eq<T>): Store<T>;

Defined in: packages/common/src/Store.ts:58

Creates a store with the given initial state. The store encapsulates its state, which can be read with get and updated with set or update. All changes are broadcast to subscribers.

By default, state changes are detected using eqSameValueZero, which considers NaN equal to itself and 0 equal to -0. You can provide a custom equality function as the second argument.