Html – Why document.addEventListener('click', handleClick, true) doesn't work
I have a react hook that detects a click outside the element: export const useClickOutside = ( ref: React.MutableRefObject<HTMLDivElement | null>, callback: Function, ) => { const handleClick = (e: MouseEvent) => { if (ref.current && !ref.current.contains(e.target as Node) {…