The hooks closes the opened DOM ref when user clicks outside.
Example
import { useRef, useState } from "react";
const Header = () => {
const [isOpen, setOpen] = useState(false);
useClickOutside(ref, () => setOpenLanguage(false));
return(
<button ref={ref} onClick={logout}> Log Out </button>
)}