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: 24 days 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'}

}
```