EffectSpec<S = any, EM extends EventMapBase = EventMapBase>
interfaceEffect specification (stateless async event consumer).
- Effects run after reducers see the event.
- Effects are async-safe and do not own state.
- Effects are keyed by event for O(1) lookup (no scanning).
- Use
when for event targeting (preferred over events).Type parameters
| Name | Type | Description |
|---|---|---|
S | — | Store state type (readonly). |
EM | extends EventMapBase | Event map. |
Properties
| Name | Type | Description |
|---|---|---|
effect | EffectFunction<S, EM> | Async effect handler: (event, getState, emit) => void | Promise<void>. |
events? | readonly EventKey<EM>[] | List of EventKeys [channel, type] that this effect responds to. |
meta? | EventConsumerMeta<"effect"> | Optional metadata for debugging tools and DevTools integration. |
when? | When<EM> | Event targeting using the unified When matcher.
Preferred over events for new code. |