Skip to content

Latest commit

 

History

History
45 lines (26 loc) · 751 Bytes

File metadata and controls

45 lines (26 loc) · 751 Bytes

useIntersection hook

This project is a custom hook for React that uses the IntersectionObserver API to observe a DOM element.

When to use useIntersection and useIntersectionRef?

useIntersection

classical useIntersection hook with useEffect and useRef

useIntersectingRef

same as useIntersection but with avoiding the need to use useEffect and useRef, allows intersection on optional or delayed elements

Getting Started

Prerequisites

  • Node.js
  • pnpm

Installing

pnpm i

Running the tests

pnpm test

Building

pnpm build

Built With