Store
Store is the central place which manages the state of the application. It is a container which holds the application state.
createStore()
Creates a store.
Signature:
createStore<T>(options: StoreOptions): Store<T>
Arguments
- options (opens in a new tab) - store options
Returns
Store
.state
Returns the current state of the store.
Signature:
store.state: StoreState;
.dispatch()
Signature:
store.dispatch(transaction: Transaction): void;
Arguments:
transaction
- A Transaction object that describes the action to be dispatched.
Example:
store.dispatch(slice.someAction());
.destroy()
Destroys the store.
Signature:
store.destroy(): void;