UNPKG

@thibault.sh/hooks

Version:

A comprehensive collection of React hooks for browser storage, UI interactions, and more

15 lines (12 loc) 678 B
import { RefObject } from 'react'; interface IntersectionOptions extends IntersectionObserverInit { freezeOnceVisible?: boolean; } /** * Hook that tracks element's intersection with viewport using IntersectionObserver * @param elementRef - React ref object pointing to the target element * @param options - IntersectionObserver options with additional freezeOnceVisible flag * @returns IntersectionObserverEntry if available, null otherwise */ declare function useIntersectionObserver(elementRef: RefObject<HTMLElement>, { threshold, root, rootMargin, freezeOnceVisible, }?: IntersectionOptions): IntersectionObserverEntry | null; export { useIntersectionObserver };