EffectSpec<S = any, EM extends EventMapBase = EventMapBase>

interface
types.ts:706

Effect 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

NameTypeDescription
SStore state type (readonly).
EMextends EventMapBaseEvent map.

Properties

NameTypeDescription
effectEffectFunction<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.