O3 Framework / useOnVisible
useOnVisible(
callBack):MutableRefObject<HTMLElement>
Defined in: packages/framework/esm-react-utils/src/useOnVisible.ts:15
Returns a ref that can be used on a HTML component to trigger an action when the component is scrolled into visible view, This is particularly useful for infinite scrolling UIs to load data on demand.
() => void
The callback to run when the component is scrolled into visible view. Care should be taken with this param. The callback should be cached across re-renders (via useCallback) and it should have logic to avoid doing work multiple times while scrolling.
MutableRefObject<HTMLElement>
a ref that can be passed to an HTML Element