@billogram/use-click-outside
A React hook for handling clicks outside of an element
Install
yarn add @billogram/use-click-outside
Usage
import useClickOutside from '@billogram/use-click-outside';
See types for exported types.
useClickOutside
const node = React.useRef<HTMLDivElement>(null);
useClickOutside(node, function onClickOutside() {
// do something when a click outside event occurs
});
Note
This library is being published with our use cases in mind and is not necessarily meant to be consumed by the broader public. We probably won't take your feature requests unless they align with our own needs.
License
MIT