# @jdthornton/useonclickoutside

> React on click outside ref target hook

Latest version **1.1.3** (published 2021-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jdthornton/useonclickoutside
pnpm add @jdthornton/useonclickoutside
yarn add @jdthornton/useonclickoutside
bun add @jdthornton/useonclickoutside
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2021-12-22 |
| First published | 2021-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jake Thornton |
| Maintainers | jdthornton |

## Links

- npm: https://www.npmjs.com/package/@jdthornton/useonclickoutside
- Repository: https://github.com/jdthornton/useonclickoutside
- Homepage: https://github.com/jdthornton/useonclickoutside#readme
- Issues: https://github.com/jdthornton/useonclickoutside/issues
- npm.io page: https://npm.io/package/@jdthornton/useonclickoutside

## Dependencies (1)

- [@jdthornton/useeventlistener](https://npm.io/package/@jdthornton/useeventlistener.md) ^1.0.4

## Recent versions

- 1.1.3 (latest) — 2021-12-22
- 1.1.2 — 2021-12-17
- 1.1.1 — 2021-10-10
- 1.1.0 — 2021-10-04
- 1.0.1 — 2021-09-30

## README

# @jdthornton/useonclickoutside

[![npm (scoped)](https://img.shields.io/npm/v/@jdthornton/useonclickoutside.svg)](https://www.npmjs.com/package/@jdthornton/useonclickoutside)
[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/@jdthornton/useonclickoutside.svg)](https://www.npmjs.com/package/@jdthornton/useonclickoutside)

React on click outside ref target hook.

## Install

```
$ npm install @jdthornton/useonclickoutside
```

## Usage

```js
import useOnClickOutside from "@jdthornton/useonclickoutside";

function App({ handleClickOutside }){
  const ref = useRef();

  useOnClickOutside(ref, handleClickOutside)

  return(
    <div ref={ref}>
      Don't click outside!
    </div>
  )
}
```

---
_Source: https://npm.io/package/@jdthornton/useonclickoutside · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
