piral-hooks-utils
Version:
Hooks and HOC for pilets and Piral instances.
9 lines (8 loc) • 372 B
TypeScript
import { RefObject } from 'react';
/**
* Hook that detects if a click outside the given reference
* has been performed.
* @param ref The reference to the element.
* @param handler The callback to invoke when an outside click happened.
*/
export declare function useOnClickOutside<T extends HTMLElement>(ref: RefObject<T>, handler: (event: MouseEvent) => void): void;