UseEvent<EM extends EventMapBase, S>

type
react/src/hooks/createHooks.ts:142

Call 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

NameTypeDescription
EMextends EventMapBaseEvent map type.
SStore state type.