Custom hook to detect clicks outside of a specified element.
This hook sets up an event listener that triggers the provided handler
when a click is detected outside the specified element. Uses the capture
phase on document so that the listener fires even when intermediate
elements call stopPropagation().
Custom hook to detect clicks outside of a specified element.
This hook sets up an event listener that triggers the provided handler when a click is detected outside the specified element. Uses the capture phase on
documentso that the listener fires even when intermediate elements callstopPropagation().