use-onclickoutside-peer-deps
v0.3.1
Published
React hook for listening for clicks outside of an element.
Downloads
220
Readme
use-onclickoutside
React hook for listening for clicks outside of an element.
Usage
import * as React from 'react'
import useOnClickOutside from 'use-onclickoutside'
export default function Modal({ close }) {
const ref = React.useRef(null)
useOnClickOutside(ref, close)
return <div ref={ref}>{'Modal content'}</div>
}