Reducer

fun interface Reducer<S : State, A : Action>

The Reducer determines what happens in response to an Action:

It's the logic unit of the Store. It receives the current State and an incoming Action, and returns a Reduction containing the new state and any Reactions.

The reducer is run atomically by the Store, ensuring thread-safe state updates.

Parameters

S

The type of State managed by the Store.

A

The type of Action the Store accepts.

Functions

Link copied to clipboard
abstract fun reduce(state: S, action: A, effectIdSource: EffectIdSource): Reduction<S, A>

Computes the next Reduction from the current state and the received action.