1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-23 18:04:47 +01:00
umami/hooks/useDocumentClick.js

14 lines
273 B
JavaScript
Raw Normal View History

2020-08-06 08:03:07 +02:00
import { useEffect } from 'react';
export default function useDocumentClick(handler) {
useEffect(() => {
document.addEventListener('click', handler);
return () => {
document.removeEventListener('click', handler);
};
}, [handler]);
return null;
}