API reference / @evolu/common / Store
Store
A mutable reference for managing state with change notifications
Interface | Description |
---|
Store | A store for managing state with change notifications. Extends Ref with subscriptions. Provides methods to get, set, and modify state, and to notify listeners when the state changes. |
Type Alias | Description |
---|
StoreListener | A callback invoked whenever the store's state updates. |
StoreSubscribe | Registers a listener for state changes, returning an unsubscribe function. |
StoreUnsubscribe | A function to remove a previously added listener. |
Function | Description |
---|
createStore | Creates a store with the given initial state. The store encapsulates its state, which can be read with get and updated with set or modify . All changes are broadcast to subscribers. |