Reducer

fun <State, Action : Any> Reducer(initialState: State, reducer: (acc: State, action: Action) -> State): Reducer<State, Action>

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

An example of a reducer that represents a counter:

val reducer = Reducer(0) { acc, action: Action ->
when (action) {
is Action.Increment -> acc + 1
is Action.Decrement -> acc - 1
}
}