Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Andarist/use-onclickoutside

React hook for listening for clicks outside of an element.
https://github.com/Andarist/use-onclickoutside

hook hooks react reactjs

Last synced: about 2 months ago
JSON representation

React hook for listening for clicks outside of an element.

Awesome Lists containing this project

README

        

# use-onclickoutside

React hook for listening for clicks outside of an element.

## Usage

```js
import * as React from 'react'
import useOnClickOutside from 'use-onclickoutside'

export default function Modal({ close }) {
const ref = React.useRef(null)
useOnClickOutside(ref, close)

return

{'Modal content'}

}
```