evento-react
Version:
- Dispatch custom component events with a payload, or forward React synthetic events. - Replicate Svelte's `createEventDispatcher` and Vue's `$emit` behavior in React. - Hook + HOC for class components. - TypeScript support.
5 lines (4 loc) • 325 B
TypeScript
import * as React from 'react';
export declare function create_custom_event<T>(evtType: string, evtDetail: T): CustomEvent<T>;
export declare function event_name_to_prop_name<T>(eventName: string): (string & keyof T);
export declare function is_synthetic_event_duck_typing(payload: any): payload is React.SyntheticEvent;