UNPKG

lazy-child

Version:

React component that renders its child when it enters the viewport

10 lines (9 loc) 566 B
import { ReactNode, Ref } from 'react'; import { Options as PeekabooOptions } from 'react-peekaboo'; declare type RenderPlaceholder<E extends HTMLElement> = (ref: Ref<E>) => ReactNode; export declare type LazyProps<E extends HTMLElement> = { children: ReactNode; renderPlaceholder: RenderPlaceholder<E>; } & Pick<PeekabooOptions, 'offsetBottom' | 'offsetLeft' | 'offsetRight' | 'offsetTop' | 'throttle'>; export default function Lazy<E extends HTMLElement>({ children, renderPlaceholder, ...peekabooOptions }: LazyProps<E>): JSX.Element; export {};