UNPKG

rooks

Version:

Essential React custom hooks ⚓ to super charge your components!

17 lines 920 B
import type { RefElementOrNull } from "../utils/utils"; /** * useEventListenerRef hook * * A react hook to an event listener to an element * Returns a ref * * @param {string} eventName The event to track` * @param {Function} callback The callback to be called on event * @param {object} listenerOptions The options to be passed to the event listener * @param {boolean} isLayoutEffect Should it use layout effect. Defaults to false * @returns {Function} A callback ref that can be used as ref prop * @see https://react-hooks.org/docs/useEventListenerRef */ declare function useEventListenerRef(eventName: string, callback: (...args: unknown[]) => void, listenerOptions?: AddEventListenerOptions | EventListenerOptions | boolean, isLayoutEffect?: boolean): (refElement: RefElementOrNull<HTMLElement>) => void; export { useEventListenerRef }; //# sourceMappingURL=useEventListenerRef.d.ts.map