useIntersection

Observe how much of an element is visible with an IntersectionObserver.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Scroll the page to change how much of the box is visible.

APIs

useIntersection

const useIntersection = <T extends HTMLElement = HTMLElement>(
  options?: IntersectionObserverInit,
) => {
  ref: (element: T | null) => void
  entry: IntersectionObserverEntry | null
}
Edit this page on GitHub