What's new
useInfiniteScroll hook
A new named export for building fully custom infinite scroll UIs. The hook manages the IntersectionObserver lifecycle and exposes sentinelRef and isLoading — your markup, your styles, your loader.
import { useInfiniteScroll } from 'react-infinite-scroll-component';
const { sentinelRef, isLoading } = useInfiniteScroll({
next: fetchMore,
hasMore,
dataLength: items.length,
});Attach sentinelRef to any element at the end of your list. isLoading is true from when next() fires until dataLength changes.
Accepts the same hasMore, dataLength, next, scrollThreshold, scrollableTarget, and inverse props as the InfiniteScroll component.
The InfiniteScroll component is unchanged. This is a purely additive export with no breaking changes.
Documentation
- README overhauled: prop descriptions expanded with behavioral detail and when-to-use guidance, all default values filled in, framework recipes added for Next.js App Router, TanStack Query, and SWR.
package.jsonkeywords and description updated for better npm discoverability.AGENTS.mdandllms.txtadded for AI tooling compatibility.
Upgrading
No breaking changes. Drop-in compatible with v7.1.0.