use-onclickoutside
v0.4.1
Published
React hook for listening for clicks outside of an element.
Downloads
315,694
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>
}