react-infinite-scroll-component vs react-infinite-scroller vs react-window-infinite-loader
Infinite Scroll Implementation in React Applications
react-infinite-scroll-componentreact-infinite-scrollerreact-window-infinite-loaderSimilar Packages:

Infinite Scroll Implementation in React Applications

react-infinite-scroll-component, react-infinite-scroller, and react-window-infinite-loader are all React packages designed to implement infinite scrolling functionality, but they take fundamentally different approaches. react-infinite-scroll-component provides a simple wrapper component that loads more content when users scroll near the bottom. react-infinite-scroller offers similar functionality with a focus on flexibility and custom scroll containers. react-window-infinite-loader takes a different approach by integrating with react-window for virtualized lists, rendering only visible items to handle large datasets efficiently. Each serves different use cases depending on your performance needs and data volume.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-infinite-scroll-component1,231,5293,086212 kB136a month agoMIT
react-infinite-scroller1,069,9983,30130.3 kB98-MIT
react-window-infinite-loader094923 kB04 months agoMIT

Infinite Scroll in React: react-infinite-scroll-component vs react-infinite-scroller vs react-window-infinite-loader

Infinite scrolling is a common pattern in modern web applications, letting users load more content as they scroll without pagination. But not all infinite scroll implementations are created equal. The three packages we're comparing — react-infinite-scroll-component, react-infinite-scroller, and react-window-infinite-loader — solve this problem in fundamentally different ways. Let's break down how they work and when to use each.

🏗️ Core Architecture: DOM Rendering vs Virtualization

react-infinite-scroll-component keeps all loaded items in the DOM.

  • Every item you load stays rendered until you manually remove it.
  • Simple to understand and debug.
  • Performance degrades as the list grows beyond a few thousand items.
import InfiniteScroll from 'react-infinite-scroll-component';

function Feed() {
  const [items, setItems] = useState(initialItems);

  const fetchMoreData = () => {
    // Load more items and append to existing list
    setTimeout(() => {
      setItems([...items, ...moreItems]);
    }, 1000);
  };

  return (
    <InfiniteScroll
      dataLength={items.length}
      next={fetchMoreData}
      hasMore={true}
      loader={<h4>Loading...</h4>}
    >
      {items.map(item => (
        <div key={item.id}>{item.content}</div>
      ))}
    </InfiniteScroll>
  );
}

react-infinite-scroller also keeps all items in the DOM.

  • Similar architecture to react-infinite-scroll-component.
  • Offers more flexibility in scroll container configuration.
  • Same performance limitations with large datasets.
import InfiniteScroll from 'react-infinite-scroller';

function Feed() {
  const [items, setItems] = useState(initialItems);

  const fetchMoreData = () => {
    setTimeout(() => {
      setItems([...items, ...moreItems]);
    }, 1000);
  };

  return (
    <InfiniteScroll
      pageStart={0}
      loadMore={fetchMoreData}
      hasMore={true}
      loader={<div key={0}>Loading...</div>}
    >
      {items.map(item => (
        <div key={item.id}>{item.content}</div>
      ))}
    </InfiniteScroll>
  );
}

react-window-infinite-loader uses virtualization.

  • Only renders items currently visible in the viewport.
  • Recycles DOM nodes as users scroll.
  • Handles hundreds of thousands of items without performance issues.
import InfiniteLoader from 'react-window-infinite-loader';
import { FixedSizeList } from 'react-window';

function Feed({ items, loadMoreItems }) {
  const isItemLoaded = index => index < items.length;

  return (
    <InfiniteLoader
      isItemLoaded={isItemLoaded}
      itemCount={items.length + 1000}
      loadMoreItems={loadMoreItems}
    >
      {({ onItemsRendered, ref }) => (
        <FixedSizeList
          height={600}
          itemCount={items.length}
          itemSize={50}
          onItemsRendered={onItemsRendered}
          ref={ref}
        >
          {({ index, style }) => (
            <div style={style} key={items[index]?.id}>
              {items[index]?.content}
            </div>
          )}
        </FixedSizeList>
      )}
    </InfiniteLoader>
  );
}

📜 Scroll Container: Window vs Custom Element

react-infinite-scroll-component defaults to window scrolling.

  • Can also work with custom scrollable elements using the scrollableTarget prop.
  • Requires passing a ref to the scrollable parent element.
<InfiniteScroll
  dataLength={items.length}
  next={fetchMoreData}
  hasMore={true}
  scrollableTarget="scrollableDiv"
  loader={<h4>Loading...</h4>}
>
  <div id="scrollableDiv" style={{ height: '400px', overflow: 'auto' }}>
    {items.map(item => (
      <div key={item.id}>{item.content}</div>
    ))}
  </div>
</InfiniteScroll>

react-infinite-scroller gives explicit control over scroll target.

  • Use useWindow prop to toggle between window and element scrolling.
  • More straightforward API for custom containers.
<InfiniteScroll
  pageStart={0}
  loadMore={fetchMoreData}
  hasMore={true}
  useWindow={false}
  loader={<div key={0}>Loading...</div>}
>
  <div style={{ height: '400px', overflow: 'auto' }}>
    {items.map(item => (
      <div key={item.id}>{item.content}</div>
    ))}
  </div>
</InfiniteScroll>

react-window-infinite-loader always uses a custom container.

  • Requires react-window list component (FixedSizeList, VariableSizeList, etc.).
  • The list component manages its own scroll container.
  • More setup but consistent behavior across environments.
<InfiniteLoader
  isItemLoaded={isItemLoaded}
  itemCount={itemCount}
  loadMoreItems={loadMoreItems}
>
  {({ onItemsRendered, ref }) => (
    <FixedSizeList
      height={600}
      width={400}
      itemCount={itemCount}
      itemSize={50}
      onItemsRendered={onItemsRendered}
      ref={ref}
    >
      {Row}
    </FixedSizeList>
  )}
</InfiniteLoader>

⚡ Performance: When DOM Size Matters

react-infinite-scroll-component works fine for small to medium lists.

  • Acceptable performance up to ~1,000-2,000 items.
  • Beyond that, you'll notice scrolling lag and increased memory usage.
  • No built-in way to unload old items from the DOM.
// All items stay in DOM - memory grows with each load
{items.map(item => (
  <div key={item.id}>{item.content}</div>
))}

react-infinite-scroller has identical performance characteristics.

  • Same DOM retention behavior as react-infinite-scroll-component.
  • Performance bottleneck is the same — too many DOM nodes.
  • You'd need to manually implement item removal for long sessions.
// Same issue - all rendered items persist
{items.map(item => (
  <div key={item.id}>{item.content}</div>
))}

react-window-infinite-loader maintains consistent performance.

  • Only ~20-30 items rendered at any time regardless of total count.
  • Memory usage stays flat even with 100,000+ items.
  • Essential for data-heavy applications or long user sessions.
// Only visible items rendered - constant memory footprint
{({ index, style }) => (
  <div style={style} key={items[index]?.id}>
    {items[index]?.content}
  </div>
)}

🔄 Loading State Management

react-infinite-scroll-component uses a simple loader prop.

  • Shows loader component when hasMore is true and loading.
  • No built-in loading state tracking — you manage it yourself.
const [loading, setLoading] = useState(false);

const fetchMoreData = async () => {
  if (loading) return;
  setLoading(true);
  const newItems = await api.fetchMore();
  setItems([...items, ...newItems]);
  setLoading(false);
};

<InfiniteScroll
  dataLength={items.length}
  next={fetchMoreData}
  hasMore={hasMore}
  loader={loading ? <h4>Loading...</h4> : null}
/>

react-infinite-scroller similar loader pattern.

  • Loader displays during loadMore execution.
  • You still manage loading state manually.
const [loading, setLoading] = useState(false);

const fetchMoreData = async () => {
  if (loading) return;
  setLoading(true);
  const newItems = await api.fetchMore();
  setItems([...items, ...newItems]);
  setLoading(false);
};

<InfiniteScroll
  pageStart={0}
  loadMore={fetchMoreData}
  hasMore={hasMore}
  loader={loading ? <div key={0}>Loading...</div> : null}
/>

react-window-infinite-loader has built-in loading state.

  • Tracks which items are loaded via isItemLoaded.
  • Shows loader automatically for unloaded items.
  • More sophisticated but requires understanding the loading contract.
const isItemLoaded = index => index < items.length;

const loadMoreItems = async (startIndex, stopIndex) => {
  const newItems = await api.fetchRange(startIndex, stopIndex);
  setItems(prev => [...prev, ...newItems]);
};

<InfiniteLoader
  isItemLoaded={isItemLoaded}
  itemCount={items.length + 1000}
  loadMoreItems={loadMoreItems}
>
  {({ onItemsRendered, ref }) => (
    <FixedSizeList
      height={600}
      itemCount={items.length}
      itemSize={50}
      onItemsRendered={onItemsRendered}
      ref={ref}
    >
      {Row}
    </FixedSizeList>
  )}
</InfiniteLoader>

🧩 Integration with react-window Ecosystem

react-infinite-scroll-component stands alone.

  • No dependencies on other libraries.
  • Easier to drop into existing projects.
  • Missing advanced features like variable row heights.
// No additional dependencies needed
import InfiniteScroll from 'react-infinite-scroll-component';

react-infinite-scroller also standalone.

  • Zero external dependencies beyond React.
  • Simple to install and use.
  • Limited to fixed-height items in practice.
// Also no additional dependencies
import InfiniteScroll from 'react-infinite-scroller';

react-window-infinite-loader requires react-window.

  • Must install both react-window and react-window-infinite-loader.
  • Gains access to full virtualization ecosystem.
  • Supports variable row heights, grids, and more.
// Requires react-window as peer dependency
import InfiniteLoader from 'react-window-infinite-loader';
import { FixedSizeList, VariableSizeList } from 'react-window';

🛠️ Maintenance Status and Community Support

react-infinite-scroll-component is actively maintained.

  • Regular updates and bug fixes.
  • Good documentation with examples.
  • Suitable for new projects with moderate data needs.

react-infinite-scroller has limited recent activity.

  • Fewer updates in recent years.
  • Still functional but consider alternatives for new projects.
  • May lack support for newer React features.

react-window-infinite-loader is well-maintained.

  • Part of the react-window ecosystem by Brian Vaughn.
  • Regular updates aligned with react-window releases.
  • Recommended for performance-critical applications.

📊 Feature Comparison Summary

Featurereact-infinite-scroll-componentreact-infinite-scrollerreact-window-infinite-loader
RenderingAll items in DOMAll items in DOMVirtualized (visible only)
PerformanceDegrades after ~2K itemsDegrades after ~2K itemsConsistent at any scale
Scroll TargetWindow or custom elementWindow or custom elementCustom element only
DependenciesNoneNoneRequires react-window
Setup ComplexityLowLowMedium
Memory UsageGrows with itemsGrows with itemsConstant
Best ForFeeds, comments, searchModals, sidebars, nestedLarge datasets, dashboards

💡 The Bottom Line

react-infinite-scroll-component is your go-to for simple infinite scroll needs. Use it for content feeds, comment sections, or search results where you expect users to load a few hundred items at most. It's easy to set up and works well for most common use cases.

react-infinite-scroller offers similar functionality with slightly more flexibility for custom scroll containers. However, given its limited recent maintenance, consider react-infinite-scroll-component instead for new projects unless you have specific requirements it addresses better.

react-window-infinite-loader is the performance champion. If you're building admin dashboards, analytics views, or any application where users might scroll through thousands of items, this is the only serious choice. The virtualization approach keeps your app responsive regardless of data volume.

Final Thought: The right choice depends on your data scale. For under 2,000 items, keep it simple with react-infinite-scroll-component. For anything larger, invest in virtualization with react-window-infinite-loader — your users' scrolling experience will thank you.

How to Choose: react-infinite-scroll-component vs react-infinite-scroller vs react-window-infinite-loader

  • react-infinite-scroll-component:

    Choose react-infinite-scroll-component if you need a straightforward infinite scroll implementation for moderate-sized lists where all items remain in the DOM. It works well for content feeds, comment sections, or search results under a few thousand items. This package is ideal when you prioritize simplicity over memory efficiency and don't need virtualization.

  • react-infinite-scroller:

    Choose react-infinite-scroller if you need more control over the scroll container or want to implement infinite scroll within a custom parent element. It supports both window and element scrolling, making it suitable for modals, sidebars, or nested scrollable areas. Pick this when you need flexibility in scroll target configuration.

  • react-window-infinite-loader:

    Choose react-window-infinite-loader if you're dealing with large datasets (thousands or millions of items) where performance and memory usage are critical. It integrates with react-window to virtualize the list, rendering only visible items. This is essential for data-heavy applications like admin dashboards, analytics views, or any scenario where DOM performance matters.

README for react-infinite-scroll-component

react-infinite-scroll-component npm npm bundlephobia

All Contributors

Infinite scroll for React. Zero runtime dependencies, IntersectionObserver-based, TypeScript-first. ~4 kB gzipped.

Works with window scroll, fixed-height containers, and custom scrollable parents. Pull-to-refresh and inverse (chat) scroll included. React 17, 18, and 19 compatible.

Install

npm install react-infinite-scroll-component
# or
yarn add react-infinite-scroll-component
# or
pnpm add react-infinite-scroll-component

Two APIs

APIWhen to use
InfiniteScroll componentMost cases, handles loader, endMessage, pull-to-refresh, inverse scroll UI
useInfiniteScroll hookCustom UI, you own the markup, the hook manages the observer

InfiniteScroll component

Basic usage (TypeScript)

import { useState } from 'react';
import InfiniteScroll from 'react-infinite-scroll-component';

type Item = { id: number; name: string };

function Feed() {
  const [items, setItems] = useState<Item[]>(initialItems);
  const [hasMore, setHasMore] = useState(true);

  const fetchMore = async () => {
    const next = await api.getItems({ offset: items.length });
    if (next.length === 0) {
      setHasMore(false);
      return;
    }
    setItems((prev) => [...prev, ...next]);
  };

  return (
    <InfiniteScroll
      dataLength={items.length}
      next={fetchMore}
      hasMore={hasMore}
      loader={<p>Loading...</p>}
      endMessage={<p style={{ textAlign: 'center' }}>All items loaded.</p>}
    >
      {items.map((item) => (
        <div key={item.id}>{item.name}</div>
      ))}
    </InfiniteScroll>
  );
}

Scroll inside a fixed-height container

<div id="scrollableDiv" style={{ height: 400, overflow: 'auto' }}>
  <InfiniteScroll
    dataLength={items.length}
    next={fetchMore}
    hasMore={hasMore}
    loader={<p>Loading...</p>}
    scrollableTarget="scrollableDiv"
  >
    {items.map((item) => (
      <div key={item.id}>{item.name}</div>
    ))}
  </InfiniteScroll>
</div>

Pass a ref value directly instead of a string id:

const containerRef = useRef<HTMLDivElement>(null);

<div ref={containerRef} style={{ height: 400, overflow: 'auto' }}>
  <InfiniteScroll
    dataLength={items.length}
    next={fetchMore}
    hasMore={hasMore}
    loader={<p>Loading...</p>}
    scrollableTarget={containerRef.current}
  >
    {items.map((item) => (
      <div key={item.id}>{item.name}</div>
    ))}
  </InfiniteScroll>
</div>;

Inverse scroll (chat / messaging UIs)

<div
  id="chatBox"
  style={{
    height: 500,
    overflow: 'auto',
    display: 'flex',
    flexDirection: 'column-reverse',
  }}
>
  <InfiniteScroll
    dataLength={messages.length}
    next={loadOlderMessages}
    hasMore={hasMore}
    loader={<p>Loading older messages...</p>}
    inverse={true}
    scrollableTarget="chatBox"
    style={{ display: 'flex', flexDirection: 'column-reverse' }}
  >
    {messages.map((msg) => (
      <div key={msg.id}>{msg.text}</div>
    ))}
  </InfiniteScroll>
</div>

Pull-to-refresh

<InfiniteScroll
  dataLength={items.length}
  next={fetchMore}
  hasMore={hasMore}
  loader={<p>Loading...</p>}
  pullDownToRefresh
  pullDownToRefreshThreshold={50}
  refreshFunction={refreshList}
  pullDownToRefreshContent={
    <h3 style={{ textAlign: 'center' }}>&#8595; Pull down to refresh</h3>
  }
  releaseToRefreshContent={
    <h3 style={{ textAlign: 'center' }}>&#8593; Release to refresh</h3>
  }
>
  {items.map((item) => (
    <div key={item.id}>{item.name}</div>
  ))}
</InfiniteScroll>

useInfiniteScroll hook

For when you need full control over your markup. Place the sentinelRef div at the end of your list, the hook fires next() when it enters the viewport.

import { useState } from 'react';
import { useInfiniteScroll } from 'react-infinite-scroll-component';

type Item = { id: number; name: string };

function CustomFeed() {
  const [items, setItems] = useState<Item[]>(initialItems);
  const [hasMore, setHasMore] = useState(true);

  const { sentinelRef, isLoading } = useInfiniteScroll({
    next: async () => {
      const more = await api.getItems({ offset: items.length });
      if (more.length === 0) {
        setHasMore(false);
        return;
      }
      setItems((prev) => [...prev, ...more]);
    },
    hasMore,
    dataLength: items.length,
  });

  return (
    <ul>
      {items.map((item) => (
        <li key={item.id}>{item.name}</li>
      ))}
      <li ref={sentinelRef} aria-hidden="true" />
      {isLoading && <li>Loading...</li>}
      {!hasMore && <li>All items loaded.</li>}
    </ul>
  );
}

Framework recipes

Next.js App Router

InfiniteScroll is a client component. Fetch initial data in a Server Component, pass it down.

// app/feed/page.tsx, Server Component
import { FeedClient } from './feed-client';
import { db } from '@/lib/db';

export default async function FeedPage() {
  const initialItems = await db.items.findMany({
    take: 20,
    orderBy: { id: 'desc' },
  });
  return <FeedClient initialItems={initialItems} />;
}
// app/feed/feed-client.tsx, Client Component
'use client';

import { useState } from 'react';
import InfiniteScroll from 'react-infinite-scroll-component';

type Item = { id: string; title: string };

export function FeedClient({ initialItems }: { initialItems: Item[] }) {
  const [items, setItems] = useState(initialItems);
  const [hasMore, setHasMore] = useState(true);

  const fetchMore = async () => {
    const res = await fetch(`/api/items?cursor=${items[items.length - 1].id}`);
    const next: Item[] = await res.json();
    if (next.length === 0) {
      setHasMore(false);
      return;
    }
    setItems((prev) => [...prev, ...next]);
  };

  return (
    <InfiniteScroll
      dataLength={items.length}
      next={fetchMore}
      hasMore={hasMore}
      loader={<p>Loading...</p>}
      endMessage={<p>You have seen everything.</p>}
    >
      {items.map((item) => (
        <article key={item.id}>{item.title}</article>
      ))}
    </InfiniteScroll>
  );
}

With TanStack Query

import { useInfiniteQuery } from '@tanstack/react-query';
import InfiniteScroll from 'react-infinite-scroll-component';

function PostFeed() {
  const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
    useInfiniteQuery({
      queryKey: ['posts'],
      queryFn: ({ pageParam = 0 }) => fetchPosts(pageParam),
      getNextPageParam: (lastPage, pages) =>
        lastPage.length === 20 ? pages.length : undefined,
    });

  const posts = data?.pages.flat() ?? [];

  return (
    <InfiniteScroll
      dataLength={posts.length}
      next={fetchNextPage}
      hasMore={!!hasNextPage}
      loader={isFetchingNextPage ? <p>Loading...</p> : null}
      endMessage={<p>All posts loaded.</p>}
    >
      {posts.map((post) => (
        <article key={post.id}>{post.title}</article>
      ))}
    </InfiniteScroll>
  );
}

With SWR

import useSWRInfinite from 'swr/infinite';
import InfiniteScroll from 'react-infinite-scroll-component';

const PAGE_SIZE = 20;

function PostList() {
  const { data, size, setSize } = useSWRInfinite(
    (index) => `/api/posts?page=${index}&limit=${PAGE_SIZE}`,
    fetcher
  );

  const posts = data ? data.flat() : [];
  const hasMore = data ? data[data.length - 1].length === PAGE_SIZE : true;

  return (
    <InfiniteScroll
      dataLength={posts.length}
      next={() => setSize(size + 1)}
      hasMore={hasMore}
      loader={<p>Loading...</p>}
    >
      {posts.map((post) => (
        <div key={post.id}>{post.title}</div>
      ))}
    </InfiniteScroll>
  );
}

Three scroll modes

ModeHow to useUse case
Window scrollOmit height and scrollableTargetSocial feeds, blogs, product listings
Fixed-height containerPass height propEmbedded lists, sidebars
Custom scrollable parentPass scrollableTarget (element or id)Existing overflow containers

Props, InfiniteScroll

PropTypeRequiredDefaultDescription
dataLengthnumberyes-Current count of rendered items. The component resets its load guard each time this value changes, which allows next() to fire again on the next scroll.
next() => voidyes-Called once when the sentinel enters the viewport. Append new items to your list state inside this callback; do not replace the existing items.
hasMorebooleanyes-When false, the observer is disconnected and next() will not be called again. Set it to false when your data source has no more pages.
loaderReactNodeyes-Rendered below the list while the next page is loading. Displayed between the last item and the bottom sentinel.
endMessageReactNodeno-Rendered below the list when hasMore is false. Use it for an "all caught up" or "no more items" message.
heightnumber | stringno-Creates a fixed-height scroll container wrapping the list. Accepts a pixel number or any CSS length string. Omit this prop to scroll the window instead.
scrollableTargetHTMLElement | string | nullno-The scrollable ancestor that already provides overflow scrollbars. Pass the element's id string or a direct HTMLElement reference. Required when the scroll container is neither the window nor the height wrapper.
scrollThresholdnumber | stringno0.8How close to the bottom the user must scroll before next() is called. A fraction like 0.8 means 80% scrolled; a string like "200px" means within 200 px of the bottom edge.
inversebooleannofalseReverse scroll direction for chat or messaging UIs. The sentinel moves to the top of the list. Use together with flexDirection: column-reverse on the scroll container.
pullDownToRefreshbooleannofalseEnable pull-to-refresh gesture on touch and mouse. Requires refreshFunction to also be set.
refreshFunction() => voidno-Called once when the user pulls down past pullDownToRefreshThreshold pixels and releases. Only active when pullDownToRefresh is true.
pullDownToRefreshThresholdnumberno100How many pixels the user must pull down before refreshFunction is triggered on release.
pullDownToRefreshContentReactNodeno-Content shown inside the pull-to-refresh area while the user is pulling but has not yet reached the threshold.
releaseToRefreshContentReactNodeno-Content shown inside the pull-to-refresh area once the threshold is passed and the user can release to trigger a refresh.
onScroll(e: UIEvent) => voidno-Callback fired on every scroll event on the container. Receives the native UIEvent. Useful for syncing UI state with scroll position.
classNamestringno''CSS class name applied to the inner scroll container div.
styleCSSPropertiesno-Inline style object applied to the inner scroll container div. Merged with the component's default layout styles.
hasChildrenbooleanno-Set to true when children is a single element or a fragment rather than an array. Helps the component detect whether visible content exists to determine scroll state.
initialScrollYnumberno-Scrolls the window to this Y offset on mount. Useful for restoring a user's scroll position when navigating back to a page.

Props, useInfiniteScroll

PropTypeRequiredDefaultDescription
dataLengthnumberyes-Current count of rendered items. The hook resets its load guard whenever this value changes, allowing next() to fire again on the next intersection.
next() => voidyes-Called once when the sentinel enters the viewport. Append new items to your list state inside this callback; do not replace the existing items.
hasMorebooleanyes-When false, the IntersectionObserver is disconnected and next() will not be called again. Set it to false when your data source has no more pages.
scrollThresholdnumber | stringno0.8How close to the edge the sentinel must be before next() fires. A fraction like 0.8 means 80% scrolled; a string like "200px" means within 200 px of the edge.
scrollableTargetHTMLElement | string | nullno-The scrollable ancestor to use as the observer root. Pass a DOM id string or an HTMLElement reference. When omitted, the observer uses the browser viewport.
inversebooleannofalseWhen true, the rootMargin is applied to the top edge instead of the bottom. Place the sentinel at the top of your list and use flexDirection: column-reverse for chat UIs.

Returns { sentinelRef, isLoading }.


What's new in v7

  • IntersectionObserver-based triggering, next() fires once when the sentinel enters the viewport, not on every scroll tick. No missed triggers, better performance.
  • useInfiniteScroll hook, low-level hook for building fully custom UIs.
  • Zero runtime dependencies, throttle-debounce removed.
  • scrollableTarget accepts HTMLElement, pass a ref value directly, not just a string id.
  • Function component rewrite, same public API, no migration needed.
  • React 17, 18, 19 compatible.

live examples

  • infinite scroll (never ending), window scroll
    • Edit yk7637p62z
  • infinite scroll till 500 elements, window scroll
    • Edit 439v8rmqm0
  • infinite scroll in an element (height 400px)
    • Edit w3w89k7x8
  • infinite scroll with scrollableTarget
    • Edit r7rp40n0zm

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Ankeet Maini
Ankeet Maini

💬 📖 💻 👀 🚧
Darsh Shah
Darsh Shah

🚇 💻 👀 🚧
Eliya Cohen
Eliya Cohen

💻
Nitin Kukreja
Nitin Kukreja

💻
Bruno Sabetta
Bruno Sabetta

💻 📖
Osmar Pérez Bautista
Osmar Pérez Bautista

💻
Shreya Dahal
Shreya Dahal

💻
Vlad Harahan
Vlad Harahan

💻 📖
Daniel Caldas
Daniel Caldas

💻
Alaeddine Douagi
Alaeddine Douagi

💻
Carlos
Carlos

💻
Championrunner
Championrunner

📖
Daniel Sogl
Daniel Sogl

💻
Darren Oster
Darren Oster

💻
Illia Panasenko
Illia Panasenko

💻
Kiko Beats
Kiko Beats

💻
Matt Trussler
Matt Trussler

💻
Nimit Suwannagate
Nimit Suwannagate

💻
Rajat
Rajat

💻
Rich
Rich

💻
Ritesh Goyal
Ritesh Goyal

💻
babycannotsay
babycannotsay

💻
cesco
cesco

💻
Harry
Harry

💻
ludwig404
ludwig404

💻
Karl Johansson
Karl Johansson

💻
Geoffrey Teng
Geoffrey Teng

💻

This project follows the all-contributors specification. Contributions of any kind are welcome!

LICENSE

MIT