@wpkernel/ui / useVisiblePrefetch
Function: useVisiblePrefetch()
ts
function useVisiblePrefetch(
ref,
fn,
options): void;Triggers a prefetch when an element becomes visible in the viewport.
This hook uses IntersectionObserver if available, otherwise it falls back to a scroll and resize listener.
Parameters
ref
RefObject<Element>
A React ref to the element to monitor.
fn
() => void
The function to call to trigger the prefetch.
options
Options for the hook.
Returns
void
