UI & Layout
useIntersectionObserverRef
About
A hook to register an intersection observer listener.
Examples
Basic usage
Arguments
| Argument | Type | Description | Default Value | 
|---|---|---|---|
| callback | IntersectionObserverCallback | Callback that will be fired when the intersection occurs | undefined | 
| options | IntersectionObserverInit | Intersection Observer config (read more) | { root: null,rootMargin: "0px 0px 0px 0px", threshold: [0, 1]} | 
Return
Returns an array with the first element in the array being the callback ref for the React component/element that needs to be observed.
| Return value | Type | Description | Default value | 
|---|---|---|---|
| ref | CallbackRef | ref for the React component/element that needs to be observed. | null |