import { type RefObject } from 'react'; /** * Hook that detects clicks outside an element * * @template T - The type of the HTML element * @param handler - Function to call when click is outside * @returns Ref object to attach to the element * * @example * ```tsx * const Dropdown = () => { * const [isOpen, setIsOpen] = useState(false); * const ref = useClickOutside(() => setIsOpen(false)); * return ( *