Created
August 10, 2021 15:15
-
-
Save chetanraj/4b499afdcc51198a056cf839eee8449f to your computer and use it in GitHub Desktop.
useOnClickOutside
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment