Store

fun <State, Action : Any> Store(reducer: Reducer<State, Action>, initialState: State = reducer.initialState, middlewares: List<Middleware<State, Action>> = emptyList(), coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.Default)): Store<State, Action>

Creates a Store that holds the state.

Return

A Store that holds the state.

Parameters

reducer

A Reducer that returns the next state, given the current state and an action to handle.

initialState

An initial state. If not specified, the Reducer.initialState is used.

middlewares

A list of Middlewares that can wrap the Store.dispatch method.

coroutineScope

A CoroutineScope of the Store. If not specified, a global CoroutineScope is created.