A hook that monitors the visibility of a native React component within the viewport.
It tracks the dimensions of the target component and determines if it's visible
based on a given offset. If no offset is provided, full visibility is required.
Param: onChange
Callback that fires when the visibility status of the component changes.
Param: config
Configuration options to determine when visibility is triggered.
Param: stopWatching
Boolean to control whether visibility checks should continue.
Returns
A ref that should be attached to the component being observed.
A hook that monitors the visibility of a native React component within the viewport. It tracks the dimensions of the target component and determines if it's visible based on a given offset. If no offset is provided, full visibility is required.
Param: onChange
Callback that fires when the visibility status of the component changes.
Param: config
Configuration options to determine when visibility is triggered.
Param: stopWatching
Boolean to control whether visibility checks should continue.
Returns
A ref that should be attached to the component being observed.
Example