Spaces:
Configuration error
Configuration error
Download src/components/hooks/useDocumentClick.ts from SreejithSHR/umami: direct link, hf CLI and curl.
- Browser
- Download file 327 Bytes
-
https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/hooks/useDocumentClick.ts
- Command line
-
hf download hf://spaces/SreejithSHR/umami/src/components/hooks/useDocumentClick.ts
-
curl -L -o useDocumentClick.ts https://huggingface.co/spaces/SreejithSHR/umami/resolve/main/src/components/hooks/useDocumentClick.ts
327 Bytes
| import { useEffect } from 'react'; | |
| export function useDocumentClick(handler: (event: MouseEvent) => any) { | |
| useEffect(() => { | |
| document.addEventListener('click', handler); | |
| return () => { | |
| document.removeEventListener('click', handler); | |
| }; | |
| }, [handler]); | |
| return null; | |
| } | |
| export default useDocumentClick; | |