useClickAnyWhere
Custom hook that handles click events anywhere on the document.
Custom hook that handles click events anywhere on the document.
Usage
import { useClickAnyWhere } from "@tilt-legal/cubitt-components/utilities/hooks";
const handleClick = (event) => {
console.log('Document clicked!', event);
};
// Attach click event handler to document
useClickAnywhere(handleClick);API
Signature
declare function useClickAnyWhere(handler: (event: MouseEvent) => void): void;Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
handler | Function | The function to be called when a click event is detected anywhere on the document. | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | void | Value returned by the hook. |