Custom hook that handles click events anywhere on the document.
import { useState } from "react";
import { useClickAnyWhere } from "@tealess/hooks";
export default function Component() {
const [count, setCount] = useState(0);
useClickAnyWhere(() => {
setCount((prev) => prev + 1);
});
return <p>Click count: {count}</p>;
}