Reducer<A, S> typedef

Reducer<A, S> = S Function(S currentState, A newAction)

A simple type alias for a reducer function. A Reducer takes a State and an Action as input and produces a state as output.

If a reducer should not react on a Action, just return the old State.

  • Param currentState S The type of the state
  • Param newAction A The type of the Actions

Implementation

typedef Reducer<A, S> = S Function(S currentState, A newAction);