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

ParameterTypeDescriptionDefault
handlerFunctionThe function to be called when a click event is detected anywhere on the document.-

Return Value

ValueTypeDescription
returnvoidValue returned by the hook.

On this page