A hook that can lazy load resources such as image/video/audio/iframe/backgroundImage.
const [callbackRef, isLoaded] = useLazyload();
const [callbackRef, isLoaded] = useLazyload();
Basic usage of useLazyload hook.
Property | Description | Type | Default |
---|---|---|---|
callbackRef | The callback function for Ref | (el: HTMLElement | null) => void | - |
isLoaded | Whether the resource is loaded | boolean | false |