File: storeoptions.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
API Reference
Examples
Framework
React
Version
Latest
Menu
Getting Started
API Reference
Examples
On this page
Copy Markdown
Interface: StoreOptions<TState, TUpdater>
=========================================
Defined in: store.ts:5
Type Parameters
---------------
⢠TState
⢠TUpdater extends AnyUpdater = (cb) => TState
Properties
----------
### onSubscribe()?
ts
optional onSubscribe: (listener, store) => () => void;
optional onSubscribe: (listener, store) => () => void;
Defined in: store.ts:18
Called when a listener subscribes to the store.
#### Parameters ##### listener
Listener<TState>
Store <TState, TUpdater>
Function
a function to unsubscribe the listener
void
ts
optional onUpdate: () => void;
optional onUpdate: () => void;
Defined in: store.ts:25
Called after the state has been updated, used to derive other state.
void
ts
optional updateFn: (previous) => (updater) => TState;
optional updateFn: (previous) => (updater) => TState;
Defined in: store.ts:12
Replace the default update function with a custom one.
#### Parameters ##### previous
TState
Function
##### Parameters ###### updater
TUpdater
TState
