RUI.next

Experimental
useLazyload

useLazyload

A hook that can lazy load resources such as image/video/audio/iframe/backgroundImage.

const [callbackRef, isLoaded] = useLazyload();
const [callbackRef, isLoaded] = useLazyload();

Example

Basic usage of useLazyload hook.

Skeleton Content loading image
Test Content loading

API

useLazyload - Result

PropertyDescriptionTypeDefault
callbackRefThe callback function for Ref(el: HTMLElement | null) => void-
isLoadedWhether the resource is loadedbooleanfalse