UNPKG

qol-hooks

Version:

A collection of React hooks to improve the quality of life of developers.

11 lines (10 loc) 458 B
/** * @description A hook to add an event listener to an element * * @param {keyof WindowEventMap} eventName The event name * @param {(event: Event) => void} handler The event handler * @param {HTMLElement | Window} element The element to add the event listener to * */ declare function useEventListener(eventName: keyof WindowEventMap | string, handler: (event: Event) => void, element?: HTMLElement | Window): void; export default useEventListener;