1.1.5 • Published 3 years ago

@byteclaw/hooks v1.1.5

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

@byteclaw/hooks

Collection of useful React hooks for your Applications.

Installation

npm install @byteclaw/hooks
yarn add @byteclaw/hooks

Hooks

Usage

import { useOverflowScrollPosition } from '@byteclaw/hooks';
import React from 'react';

function ScrollableBox(children) {
  const box = useRef(null);
  const [scrollPosition, scrollHeight] = useOverflowScrollPosition(box);

  if (scrollPosition !== null && scrollPosition === scrollHeight) {
    console.log(`You've successfully scrolled to the end, yay!`);
  }

  return <div ref={box}>{children}</div>;
}