React Hooks Lab Docz
Getting StartedInstallUsageContributingChangeloguse-intersection-observeruse-mouse-positionuse-on-hoveruse-scroll-directionuse-scroll-progressuse-scroll-to-topuse-window-size

What's this

Collection of hooks that we re-use at Jam3

Why?

Since the React landscape is changing with the introduction of hooks and the "deprecation" of classes is useful for us to keep a collection of hooks so we can share functionality between projects.

You could face 3 cases

  1. The functionality that you need is already here so just npm install
  2. There is some missing functionality so you want to make the hook dynamic to multiple cases well open a PR
  3. Your use case is too specific, just copy and paste the hook and adapt it these way at least you're not starting from 0 and with best practices

Install

npm install react-hooks-lab
yarn add react-hooks-lab

Usage

// Import depending what you need it will tree-shake the modules
import { useIntersectionObserver } from "react-hooks-lab";
import { useMousePosition } from "react-hooks-lab";
import { useOnHover } from "react-hooks-lab";
import { useScrollDirection } from "react-hooks-lab";
import { useScrollProgress } from "react-hooks-lab";
import { useScrollToTop } from "react-hooks-lab";
import { useWindowSize } from "react-hooks-lab";

For more information, please refer to Usage in our documentation.

Contributing

Please make sure to read the contributing guide before making a pull request.

Changelog

Detailed changes for each release are documented in the release notes.