@mcesarczyk/react-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

React-hooks

1. useOnClickOutside

Runs a callback when a click event is detected outside of the provided element.

Usage:

export const Wrapper = () => {
const elementRef = useRef<HTMLDivElement>(null);
  ...

  useOnClickOutside(elementRef, doSomething);

  return (
      <div ref={elementRef} />
  );
};

Package Sidebar

Install

npm i @mcesarczyk/react-hooks

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

7.42 kB

Total Files

15

Last publish

Collaborators

  • mcesarczyk