UNPKG

piral-hooks-utils

Version:

Hooks and HOC for pilets and Piral instances.

12 lines (11 loc) 538 B
import { RefObject } from 'react'; /** * Hook that detects if a reference element within the main document is * visible. * Useful for performing some animation or triggering certain actions (e.g., * loading data for infinity scrolling) when an element appears or is close * to appear on screen. * @param ref The reference element to be visible. * @param rootMargin The tolerance level to the reference element. */ export declare function useOnScreenVisible<T extends HTMLElement>(ref: RefObject<T>, rootMargin?: string): boolean;