How to Build Large Virtualize List using React 18 Window

Last Updated on by in React JS

Handling extensive data in React can compromise performance; we can manage the large data using Virtualize list.

In this guide, you will ascertain how to create virtualize list component in React js application and handle the large records in a list using the react-window package.

The react-window module is especially used to render large lists in React.

It displays only rendered content in multiple rows and table views format in React.

The react window package is exceptionally facile to implement and swiftly renders only rendering part of a large data set through the virtualization method in React.

React JS Render Large Virtualize List Example

  • Step 1: Create React Application
  • Step 2: Add React Window Package
  • Step 3: Set Up Bootstrap CSS
  • Step 4: Make New Component
  • Step 5: Create Large List Component
  • Step 6: Update App Component
  • Step 7: View App on Browser

Create React Application

To install or create a new project called react-blog, execute the suggested command from the terminal.

Make sure to have Node and NPM configured on your system before you invoke the command.

npx create-react-app react-blog

Next, go inside the project folder.

cd react-blog

Add React Window Package

You have to add the react-window package now, therefore use the suggested command using npm through the console.

npm i react-window --legacy-peer-deps

Set Up Bootstrap CSS

If you are not comfortable writing custom CSS. Worry not! we have a ready-made solution for your.

Execute the following command using npm from the terminal.

npm i bootstrap --legacy-peer-deps

Now, the bootstrap module is added and saved in the package.json file, add the Bootstrap CSS file path in the App.js file.

import React from "react";
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "./App.css";

function App() {
  return (

export default App;

Make New Component

Head towards the src/ folder, create the new folder name it components/. Subsequently, make the LongList.js file, this will be the pivot point of your React project.

import React from 'react'

function LongList() {
  return (
    <div>LongList page</div>

export default LongList

Create Large List Component

Now, add the code into the components/LongList.js file.

We imported FixedSizeList module from “react-window” pacakge.

Set the functional component state for managing the data for virtualized list.

Render the data in the extensive list using the map method.

You can customize the List component using the list properties and set the height, width, item size, item count, etc.

import React, { useState, useEffect } from "react";
import { FixedSizeList as List } from "react-window";

export default function LongList() {
  const [users, setUsers] = useState([]);

  const REST_API = "";

  useEffect(() => {
      .then((response) => response.json())
      .then((response) => {
  }, [users]);

  const virtualizeList = () => (
    <ul className="list-group">
      {, index) => {
        return (
          <li className="list-group-item" key={index}>

  function initOnWheel({ deltaY }) {
    console.log("Event invoked on whell movement", deltaY);

  const handleElement = React.forwardRef((props, ref) => (
    <div ref={ref} onWheel={initOnWheel} {...props} />

  return (

Update App Component

The LongList component is ready, however it won’t display result on the browser.

There is one more thing left to be done; that is to add the LongList component to the src/App.js main component.

Here is how you can register the LongList component.

import React from "react";
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "./App.css";
import LongList from "./components/LongList";

function App() {
  return (
    <div className="container mt-5">
      <h2 className="mb-3">React JS Render Large Virtualize List Example</h2>
      <LongList />

export default App;

View App on Browser

In the last step, we have to ultimately start the React application. We can do it by executing the following command, use the given command.

npm start

On the console given url will be shown; you can use the URL to view the app on the browser.


How to Build Large Virtualize List using React Window


In this post, we have found how to render only the rendered part of a large data set in React JS.

It reduces the amount of work and elevates the performance when it comes to rendering the initial view and processing updates.

On the other hand, this lowers the memory footprint by sidestepping the over-allocation of DOM nodes.

Digamber - Author

Hi, I'm Digamber Singh, a New Delhi-based full-stack developer, tech author, and open-source contributor with 10+ years' experience in HTML, CSS, JavaScript, PHP, and WordPress.