useClickAnyWhere
Custom hook that handles click events anywhere on the document.
Installation
npx sse-tool add use-click-any-where
npm install sse-hooks
Usage
import { useClickAnyWhere } from "./{hooks file}";
const handleClick = (event) => {
console.log("Document clicked!", event);
};
// Attach click event handler to document
useClickAnywhere(handleClick);
import { useClickAnyWhere } from "sse-hooks";
const handleClick = (event) => {
console.log("Document clicked!", event);
};
// Attach click event handler to document
useClickAnywhere(handleClick);
API
Parameters
| Name | Type | Description |
|---|---|---|
| handler | Function | The function to be called when a click event is detected anywhere on the document. |