MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / onOutsideClick

Function onOutsideClick

apps/web/ui/Dropdown/index.tsx:19–24  ·  view source on GitHub ↗
(event: any)

Source from the content-addressed store, hash-verified

17 const [open, setOpen] = useState(false);
18 const ref = useRef(null);
19 const onOutsideClick = (event: any) => {
20 const node = ref.current as HTMLDivElement | null;
21 if (node && !node.contains(event.target)) {
22 setOpen(false);
23 }
24 };
25
26 useEffect(() => {
27 document.addEventListener('click', onOutsideClick, false);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected