@jdthornton/useonclickoutside
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

@jdthornton/useonclickoutside

npm (scoped) npm bundle size (minified)

React on click outside ref target hook.

Install

$ npm install @jdthornton/useonclickoutside

Usage

import useOnClickOutside from "@jdthornton/useonclickoutside";

function App({ handleClickOutside }){
  const ref = useRef();

  useOnClickOutside(ref, handleClickOutside)

  return(
    <div ref={ref}>
      Don't click outside!
    </div>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @jdthornton/useonclickoutside

Weekly Downloads

2

Version

1.1.3

License

MIT

Unpacked Size

3.35 kB

Total Files

5

Last publish

Collaborators

  • jdthornton