inspired by [tj/react-click-outside](https://github.com/tj/react-click-outside) but supported by TypeScript and React Hooks!
npm install react-click-outsider```
yarn add 'react-click-outsider'
NOTE: Make sure your application is using react >= 16.8
`js
import ClickOutside from 'react-click-outsider'
import React, { setState } from 'react'
function App() {
const [isOpen, setOpen] = useState(true)
return (
Something to close when clicking outside eg. modal, tooltip, etc.
)
}
`
A custom hook dealing with clicks outside. ClickOutside uses this custom hook internally.
`js
import {useClickOutside} from 'react-click-outsider'
import React, { setState, useRef } from 'react'
function App() {
const container = useRef(null)
const [isOpen, setOpen] = useState(true)
useClickOutside(container, () => setOpen(false))
return (