UNPKG

@thibault.sh/hooks

Version:

A comprehensive collection of React hooks for browser storage, UI interactions, and more

12 lines (9 loc) 455 B
import { RefObject } from 'react'; type Handler = (event: MouseEvent | TouchEvent) => void; /** * Hook that handles click outside of the referenced element * @param ref - React ref object for the element to monitor * @param handler - Callback function to execute when click outside occurs */ declare const useClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T | null> | null, handler: Handler) => void; export { useClickOutside };