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

1.4.0 • Public • Published

components-hooks

Hooks that are used across our repos.

Usage

  1. useIntersectionObserver
import { useIntersectionObserver } from "@arcteryx/components-hooks";

const ProductTileWrapper = ({ product }) => {
   useIntersectionObserver({
    target: ref,
    deps: [product.id],
    rootMargin: "600px",
    onIntersect: ([{ isIntersecting }], observerElement) => {
      if (isIntersecting) {
        lazyloadProduct();
        if (observerElement && ref.current) {
          observerElement.unobserve(ref.current);
        }
      }
    },
  });

  return (
    <ProductTile product={product} />
  );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @arcteryx/components-hooks

Weekly Downloads

355

Version

1.4.0

License

ISC

Unpacked Size

39.6 kB

Total Files

39

Last publish

Collaborators

  • justinohalloran
  • ronvs
  • jamiearc