useIntersectionObserver
API
import useIntersectionObserver from '@restart/hooks/useIntersectionObserver'
useIntersectionObserver
<TElement>(element: TElement | null | undefined, options?: IntersectionObserverInit) => IntersectionObserverEntry[]Setup an
IntersectionObserver
on a DOM Element that returns it's entries as they arrive.Parameters
element
TElement | null | undefinedThe DOM element to observe
options?
IntersectionObserverInit
Return Value IntersectionObserverEntry[]
useIntersectionObserver
<TElement>(element: TElement | null | undefined, callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => voidSetup an
IntersectionObserver
on a DOM Element. This overload does not trigger component updates when receiving new entries. This allows for finer grained performance optimizations by the consumer.Parameters
element
TElement | null | undefinedThe DOM element to observe
callback
IntersectionObserverCallbackA listener for intersection updates.
options?
IntersectionObserverInit
Return Value void