rx-hotkeys
Version:
Advanced Keyboard Shortcut Management library using rxjs
14 lines • 770 B
TypeScript
/**
* A custom React hook that creates a stable function reference (a "callback event")
* that will always call the latest version of the function passed to it.
* This is a TypeScript implementation of the pattern used to polyfill the
* upcoming official `useEffectEvent` hook.
*
* @template T - The type of the callback function.
* @param {T} callback - The function to be made stable. This function can use
* the latest props and state, and it will be updated on every render.
* @returns {T} A memoized function that has a stable identity across re-renders
* but executes the most recent version of the `callback`.
*/
export declare function useEventCallback<T extends (...args: any[]) => any>(callback: T): T;
//# sourceMappingURL=useEventCallback.d.ts.map