0.0.1-alpha.3 • Published 2 years ago
@rendr-view/use-outside-alerter v0.0.1-alpha.3
@rendr-view/use-outside-alerter
A React hook that can trigger a callback function when the user interacts with any content outside the target element.
Installation
yarn add @rendr-view/use-outside-alerter
Example usage
function Comp() {
const ref = React.useRef();
useOutsideAlerter(
ref,
() => {
// the user has clicked outside the modal, you may want to close it
},
);
return <div ref={ref} className="Modal">{...content}</div>
}
0.0.1-alpha.3
2 years ago
0.0.1-alpha.2
2 years ago