UNPKG

evently-react

Version:

A Hook-Based Framework for Event-Driven React Apps

8 lines (7 loc) 360 B
import { Events } from '../types'; /** * useSubscribeState hook to listen for specific events and track the latest event payload as state. * @param eventName The name of the event to subscribe to. * @returns The latest payload emitted by the event. */ export declare function useSubscribeState<E extends keyof Events>(eventName: E): Events[E] | undefined;