1.0.2 • Published 5 years ago

react-click-away-hook v1.0.2

Weekly downloads
4
License
MIT
Repository
-
Last release
5 years ago

React hook for handling click away

Useful for when you need to handle a user clicking on something that isn't your component.

For instance when showing in-page menus, dialogues, and modal.

install:

yarn add react-click-away-hook

usage:

import useClickAway from "react-click-away-hook";

const MyApp = () => {
  const elementRef = useClickAway(() => {
    console.log("Clicked Away");
  });

  return <div ref={elementRef}>Some content</div>;
};
1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago