Skip to main content

Scaling React Data Grids to Millions of Rows

Updated 6 min readMarkdown

Large datasets expose performance problems that aren't visible during early development.

A React Grid Layout may perform well with a few thousand rows but struggle with hundreds of thousands of records. Rendering, memory usage, network transfer, sorting, and filtering can all become bottlenecks.

For enterprise applications, combine rendering optimization with an architecture that keeps large datasets on the server.

In this guide, we'll look at:

  • Row virtualization and buffered rendering

  • Server-side data loading

  • Infinite scrolling and pagination

  • Server-side sorting and filtering

  • API and database considerations

  • Performance testing

    1. Understand the performance bottlenecks

    A large data grid typically faces three different problems.\

    Problem

    Cause

    Solution

    Rendering

    Too many DOM elements

    Row virtualization

    Memory

    Entire dataset loaded in browser

    Server-side loading

    Processing

    Client-side sort/filter on large arrays

    Database processing

    Virtualization is important, but it's not a complete solution by itself.

    If you load one million records into JavaScript and virtualize their rendering, the DOM may remain manageable while browser memory and data processing remain expensive.

    2. Buffered rendering / row virtualization

    Buffered rendering limits the rows rendered into the DOM.

    The grid renders the visible rows and a small buffer. When the viewport changes, rendered rows are reused to represent the new range.

    Full dataset ┌───────────────────────────────┐ │ 1 │ │ 2 │ │ 3 │ │ ... │ │ 500,000 │ └───────────────────────────────┘

    Rendered viewport ┌───────────────────────────────┐ │ Buffer rows │ │ Visible row 101 │ │ Visible row 102 │ │ Visible row 103 │ │ Visible row 104 │ │ Buffer rows │ └───────────────────────────────┘
    This approach avoids rendering every record simultaneously.

    Virtualization best practices

    • Give the grid a defined height.
    • Prefer consistent row heights.
    • Keep custom cell renderers lightweight.
    • Minimize unnecessary updates to row data.
    • Consider column virtualization for grids with many columns.

    3. Server-side data loading

    For very large datasets, fetch records on demand.

    A typical API request may include:


GET /api/orders?start=0&limit=200\

Sorting and filtering parameters can be added:


GET /api/orders ?start=0 &limit=200 &sort=amount &direction=DESC &region=EMEA

The backend performs the query and returns the required rows.

Example response:

{ "data": [ { "id": 1001, "customer": "Acme Corporation", "region": "EMEA", "amount": 12500 } ], "total": 1000000 }\

The total field helps the grid understand the overall dataset size, while the data array contains the current result window.

4. Infinite scrolling using a buffered store

Infinite scrolling is ideal when users browse records continuously.

The grid loads additional pages as the scroll position approaches the end of the current buffer.

Example ReExt configuration:
Configuration breakdown

Setting

Explanation

pageSize

Number of rows requested in each page

leadingBufferZone

Rows prefetched ahead of the viewport

trailingBufferZone

Rows retained behind the viewport

purgePageCount

Number of cached pages retained

The buffered store helps manage the loading and caching of records as the user navigates through the dataset.5. Pagination as an alternative

Pagination is often simpler for applications where users search for records instead of continuously scanning them.

store: {

pageSize: 100,

remoteSort: true,

remoteFilter: true,

\

proxy: {

type: 'ajax',

url: '/api/orders',

\

reader: {

type: 'json',

rootProperty: 'data',

totalProperty: 'total'

}

},

\

autoLoad: true

}

A paging toolbar can provide navigation between pages.

Choosing the right pattern

Requirement

Recommended approach

Continuous browsing

Infinite scrolling

Search and record lookup

Pagination

Reports

Pagination

Monitoring dashboards

Infinite scrolling

Large datasets

Server-side processing

Smaller local datasets

Local store + virtualization

The choice should be driven by user behavior and backend requirements.

6. Server-side sorting and filtering

Avoid processing millions of rows in the browser.

Instead of filtering a large local array:
const filteredOrders = orders.filter( order => order.status === 'Open' );

Send the filter to the backend.

Example SQL:

SELECT id, customer, region, amount, status

FROM orders

WHERE status = 'Open'

ORDER BY amount DESC

LIMIT 200;

Database indexes on frequently filtered and sorted columns can make these queries significantly more efficient.

Always validate client-provided sort columns using an allowlist, and parameterize filter values to avoid SQL injection.

7. Handle enterprise grid features correctly

Server-side data introduces additional considerations.

Aggregation and totals

Calculate summaries in the database. Client-side summaries may represent only the currently loaded rows.

Export

Generate large exports on the server using the grid's current query and filter criteria.

Select all\

Represent selection using a query or filter definition rather than millions of record IDs.

Deep pagination

Large OFFSET queries can become expensive. For sequential browsing, keyset or cursor-based pagination may be more efficient.

Error handling

The grid should provide loading indicators, handle failed requests, and avoid leaving users with an unresponsive interface.

8. Performance testing checklist

Test your implementation with realistic production-sized data.

Metric

How to evaluate

Time to first rows

Measure initial data load

Scroll smoothness

Record scrolling with browser performance tools

API latency

Monitor network requests

Memory usage

Compare memory before and after extended navigation

Filter latency

Measure the time from filter input to updated rows

Don't rely exclusively on vendor benchmarks. Test your actual data, column count, cell complexity, and user hardware.

Conclusion

A performant grid at million-row scale requires more than a virtualized renderer.

The scalable architecture is:

  • Buffered rendering to minimize DOM elements.
  • Server-side data loading to control browser memory.
  • Database-side sorting and filtering.
  • Infinite scrolling or pagination based on the UX.
  • Server-side aggregation and exports.
  • Realistic performance testing.

For React applications that need enterprise-grade grid functionality, ReExt provides access to the Ext JS grid, including buffered rendering and server-side store patterns.

No comments yet. Be the first to comment.