UseEvent<EM extends EventMapBase, S>
typeCall signature for the typed useEvent hook returned by createHooks.
Subscribes to store events from a React component. Useful for notifications,
animations, analytics, and responding to rejected (uncommitted) events.
Definition
type
type UseEvent<EM extends EventMapBase, S> = (channel: C, type: T, handler: (event: Event<EM, C, T>, getState: () => DeepReadonly<S>, emit: Emit<EM>, phase: "committed" | "uncommitted") => void | Promise<void>, phase?: EventPhase) => void(channel: C, type: T, handler: (event: Event<EM, C, T>, getState: () => DeepReadonly<S>, emit: Emit<EM>, phase: "committed" | "uncommitted") => void | Promise<void>, phase?: EventPhase) => void
Type parameters
| Name | Type | Description |
|---|---|---|
EM | extends EventMapBase | Event map type. |
S | — | Store state type. |