# @miyauci/react-click-outside

> react custom hooks for outside click

Latest version **1.0.4** (published 2021-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @miyauci/react-click-outside
pnpm add @miyauci/react-click-outside
yarn add @miyauci/react-click-outside
bun add @miyauci/react-click-outside
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-04-14 |
| First published | 2021-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | TomokiMiyauci |
| Maintainers | miyauci |
| Keywords | react, hooks, react-hooks, click, click-outside, outside |

## Links

- npm: https://www.npmjs.com/package/@miyauci/react-click-outside
- Repository: https://github.com/TomokiMiyauci/click-outside
- Homepage: https://github.com/TomokiMiyauci/click-outside/tree/main/packages/react#readme
- Issues: https://github.com/TomokiMiyauci/click-outside/issues
- Funding: https://www.patreon.com/tomoki_miyauci
- npm.io page: https://npm.io/package/@miyauci/react-click-outside

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-04-14
- 1.0.3 — 2021-04-14
- 1.0.2 — 2021-04-14
- 1.0.1 — 2021-04-13
- 1.0.0 — 2021-04-13

## README

<div align="center">
  <img width="180" src="../../docs/public/logo-react.png" alt="logo image" />

![npm version](https://img.shields.io/npm/v/@miyauci/react-click-outside.svg?style=flat)
![bundle size](https://img.shields.io/bundlephobia/min/@miyauci/react-click-outside)
![npm download](https://img.shields.io/npm/dw/@miyauci/react-click-outside?color=blue)
![npm type definitions](https://img.shields.io/npm/types/@miyauci/react-click-outside)
![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)
![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat)
![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)
![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

</div>

# @miyauci/react-click-outside

## :truck: Install

```bash
npm i -s @miyauci/react-click-outside
or
yarn add @miyauci/react-click-outside
```

## :bulb: Usage

This provides React Custom Hooks.

```tsx
import React, { useRef } from 'react'
import { useClickOutside } from '@miyauci/react-click-outside'

const App: FC = () => {
  const ref = useRef<HTMLElement>(null)
  const onClick = () => console.log('Outside clicked')

  useClickOutside(ref, onClick)

  return (
    <div>
      Outer
      <div ref={ref}>
        <div>Inter</div>
      </div>
    </div>
  )
}
```

## :revolving_hearts: Related

- [@miyauci/vue-click-outside](../vue)

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