Version: v4.6.0use-outside-clickAbout#Outside click(for a ref) event as hook for React.Installation#npm install --save @rooks/use-outside-clickCopyImporting the hook#import useOutsideClick from "@rooks/use-outside-click";CopyUsage#function Demo() { const pRef = useRef(); function outsidePClick() { alert("Clicked outside p"); } useOutsideClick(pRef, outsidePClick); return ( <div> <p ref={pRef}>Click outside me</p> </div> );} render(<Demo />);CopyJoin Bhargav's discord server#You can click on the floating discord icon at the bottom right of the screen and talk to us in our server.