npm.io
1.2.0 • Published 5 years ago

@billogram/use-click-outside

Licence
MIT
Version
1.2.0
Deps
1
Size
11 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

@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