ReducerSpec<S = any, EM extends EventMapBase = EventMapBase>
interfaceOne reducer's definition blob (stateful event consumer).
Use
when for event targeting (preferred). The events property is
kept for backward compatibility but when is recommended for new code.Type parameters
| Name | Type | Description |
|---|---|---|
S | — | State managed by this reducer. |
EM | extends EventMapBase | Event map. |
Properties
| Name | Type | Description |
|---|---|---|
events? | readonly EventKey<EM>[] | List of EventKeys [channel, type] that this reducer responds to. |
meta? | EventConsumerMeta<"reducer"> | Optional metadata for debugging tools and DevTools integration. |
reducer | ReducerFunction<S, EM> | Pure reducer function: (state, event) => nextState. |
state | S | Initial state for this reducer. |
when? | When<EM> | Event targeting using the unified When matcher.
Preferred over events for new code. |