createStore
Store<
Creates a store that holds the state tree.
The only way to change the data in the store is to call dispatch() on it.
There should only be a single store in your app. To specify how different
parts of the state tree respond to actions, combine several reducers into
a single reducer function using combineReducers.
reducer A function that returns the next state tree, given the current
state tree and the action to handle.
preloadedState The initial state. You may optionally specify it to
hydrate the state from the server in universal apps, or to restore a
previously serialized user session.
enhancer Optional store enhancer. Use applyMiddleware() to add
middleware support.
Implementation
Store<S> createStore<S>(
Reducer<S> reducer,
S preloadedState, {
StoreEnhancer<S>? enhancer,
}) => enhancer != null
? enhancer(_createStoreImpl, reducer, preloadedState)
: _createStoreImpl(reducer, preloadedState);