npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aleksey_grishechkin/react-chunk-virtualizer

v1.1.0

Published

A React hook for list virtualization that renders items incrementally in chunks as the user scrolls.

Readme

@aleksey_grishechkin/react-chunk-virtualizer

A React hook for list virtualization (windowing) that renders items incrementally in chunks as the user scrolls. It keeps the DOM node count stable on large datasets by rendering only the visible viewport items plus a small buffer.

Features

  • Hybrid Rendering: Combines progressive chunk loading with virtual windowing.
  • ResizeObserver Integration: Automatically tracks the scroll container dimensions.
  • Scroll Optimization: Uses requestAnimationFrame and passive event listeners to throttle scroll updates.
  • No Dependencies: Written in TypeScript with zero external dependencies.
  • Bidirectional: Supports both vertical lists and horizontal carousels.

Installation

npm install @aleksey_grishechkin/react-chunk-virtualizer
# or
yarn add @aleksey_grishechkin/react-chunk-virtualizer
# or
pnpm add @aleksey_grishechkin/react-chunk-virtualizer

Usage

1. Vertical List

import React, { useRef } from 'react';
import { useChunkVirtualizer } from '@aleksey_grishechkin/react-chunk-virtualizer';

const VerticalList = ({ data }) => {
  const containerRef = useRef<HTMLDivElement>(null);

  const { virtualItems, totalSize } = useChunkVirtualizer({
    itemCount: data.length,
    itemSize: 40, // Item height in pixels
    scrollContainerRef: containerRef,
    direction: 'vertical',
    overscan: 5,
  });

  return (
    <div
      ref={containerRef}
      style={{ height: '500px', overflowY: 'auto', position: 'relative' }}
    >
      <div style={{ height: `${totalSize}px`, width: '100%', position: 'relative' }}>
        {virtualItems.map((virtualItem) => {
          const item = data[virtualItem.index];
          return (
            <div
              key={virtualItem.index}
              style={{
                position: 'absolute',
                top: 0,
                left: 0,
                width: '100%',
                height: `${virtualItem.size}px`,
                transform: `translateY(${virtualItem.start}px)`,
              }}
            >
              {item.title}
            </div>
          );
        })}
      </div>
    </div>
  );
};

2. Horizontal Carousel

import React, { useRef } from 'react';
import { useChunkVirtualizer } from '@aleksey_grishechkin/react-chunk-virtualizer';

const HorizontalCarousel = ({ items }) => {
  const containerRef = useRef<HTMLDivElement>(null);

  const { virtualItems, totalSize } = useChunkVirtualizer({
    itemCount: items.length,
    itemSize: 300, // Item width in pixels
    scrollContainerRef: containerRef,
    direction: 'horizontal',
    overscan: 3,
  });

  return (
    <div
      ref={containerRef}
      style={{ width: '100%', overflowX: 'auto', position: 'relative' }}
    >
      <div style={{ width: `${totalSize}px`, height: '200px', position: 'relative' }}>
        {virtualItems.map((virtualItem) => (
          <div
            key={virtualItem.index}
            style={{
              position: 'absolute',
              top: 0,
              left: 0,
              width: `${virtualItem.size}px`,
              height: '100%',
              transform: `translateX(${virtualItem.start}px)`,
            }}
          >
            <img src={items[virtualItem.index].url} alt="" style={{ width: '100%', height: '100%' }} />
          </div>
        ))}
      </div>
    </div>
  );
};

API Reference

useChunkVirtualizer(options)

Configuration Options

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | itemCount | number | Required | Total number of items in the collection. | | itemSize | number | Required | Fixed height (vertical) or width (horizontal) of a single item in pixels. | | scrollContainerRef | React.RefObject | Required | React ref attached to the scrollable container element. | | initialCount | number | 30 | Number of items initially available for rendering before chunk expansion is triggered. | | step | number | 20 | Number of items added to the rendered limit when reaching the threshold boundary. | | direction | 'vertical' \| 'horizontal' | 'vertical' | Layout direction of the list. | | overscan | number | 5 | Number of extra items to render outside the visible viewport boundary to prevent blank spaces. | | resetTrigger | any | undefined | A primitive value (string, number, boolean). Changing this value automatically calls the reset function (useful for filtering or sorting). |

Return Value

| Property | Type | Description | | :--- | :--- | :--- | | virtualItems | VirtualItem[] | Array of items that should be rendered in the current viewport window. Each item contains index, size, and start coordinate. | | totalSize | number | The total height or width (in pixels) calculated for the inner wrapper spacer element. | | loadedCount | number | The current total number of items loaded into the chunk pool. | | reset | () => void | Function to manually scroll the container back to 0 and reset the chunk count to initialCount. |


License

MIT © 2026 Alexey Grishechkin