import { useOnClickOutside } from "https://deno.land/x/netzo@0.5.63/deps/usehooks-ts.ts";
Custom hook for handling clicks outside a specified element.
Examples
const containerRef = useRef(null);
useOnClickOutside([containerRef], () => {
// Handle clicks outside the container.
});
const containerRef = useRef(null); useOnClickOutside([containerRef], () => { // Handle clicks outside the container. });
Parameters
- The React ref object(s) representing the element(s) to watch for outside clicks.
- The callback function to be executed when a click outside the element occurs.