1.0.2 • Published 3 years ago

react-justu v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-justu

A cool library that contains set of tools for common implementations

Installation

Using npm:

$ npm i react-justu --save-dev

Using yarn:

$ yarn add -D react-justu

Usage

import { useRef } from "react";
import { useClickOutside } from "react-justu";

export const MyComponent = () => {
  const wrapperRef = useRef(null);

  const doSomething = () => {
    alert("hello");
  };
  useClickOutside(wrapperRef, doSomething);

  return (
    <div>
      <div ref={wrapperRef}>Click outside</div>
    </div>
  );
};