API Reference / @evolu/common / Store

Store

Interfaces

InterfaceDescription
StoreA store for managing state with change notifications. Provides methods to retrieve the current state, update it, and notify listeners of changes. The state is immutable externally, with updates controlled via setState. Think of it as a lightweight, observable reference (akin to a Ref in functional programming) tailored for reactive state management.

Type Aliases

Type AliasDescription
StoreListenerA callback invoked whenever the store's state updates.
StoreSubscribeRegisters a listener for state changes, returning an unsubscribe function.
StoreUnsubscribeA function to remove a previously added listener.

Functions

FunctionDescription
createStoreCreates a store with the given initial state. The store encapsulates a mutable reference to its state, exposed immutably via getState and updated via setState, with changes broadcast to subscribers.

Was this page helpful?