Getting Started

React Toolbelt provides a suite of hooks and helper functions that supercharges your React Developer experience by providing easy-to-use Hooks and utility functions and types to eliminate guessword and enhance productivity.

Installation

1
2
3
4
5
# Using yarn
yarn add @react-toolbelt/hooks

# Using npm
npm i add @react-toolbelt/hooks

Using Hooks

1
2
3
4
5
6
7
8
9
10
11
import { useClick } from '@react-toolbelt/hooks';

useClick(undefined, (target) => {
  if (
    (target.closest('nav#RHD-HeaderMenu') === menuRef.current &&
      target.tagName !== 'A') ||
    target.closest('button#RHD-BurgerMenu') === burgerRef.current
  )
    return;
  else setShowMenu(false);
});