# @ajeamme/use-click-outside

> Made with create-react-library

Latest version **1.0.0** (published 2021-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ajeamme/use-click-outside
pnpm add @ajeamme/use-click-outside
yarn add @ajeamme/use-click-outside
bun add @ajeamme/use-click-outside
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-12-08 |
| First published | 2021-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | anthonyjeamme |
| Maintainers | jinga |

## Links

- npm: https://www.npmjs.com/package/@ajeamme/use-click-outside
- Repository: @ajeamme/use-click-outside
- npm.io page: https://npm.io/package/@ajeamme/use-click-outside

## Recent versions

- 1.0.0 (latest) — 2021-12-08

## README

# How to use

```tsx
const Component = () => {
  const rootRef = useRef<HTMLDivElement>()
  const [isOpen, setIsOpen] = React.useState(false)

  useClickOutside(isOpen, setIsOpen, rootRef)

  return (
    <div ref={rootRef}>
      <button>{isOpen ? 'Open dropdown' : 'Close dropdown'}</button>

      {isOpen && <MyDropdown />}
    </div>
  )
}
```

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