React UI Components Documentation
This tutorial puts 100,000 rows in a React grid and moves twenty of their prices every second, while the rest of the page keeps re-rendering. It covers the three things that keep such a grid fast: let it virtualize, keep React from rendering it, and change cells instead of replacing the data.

Use a Vite React app set up as in Create a React app with Vite. The example works with jqwidgets-scripts 27.0.1 or later.
With a fixed height, the grid creates elements only for the rows in view (17 here) and reuses them as you scroll, whatever the number of rows. autoheight makes the grid as tall as its rows, so it has to create every row of the page: keep it for small tables or with paging.
The data and its adapter are created once, when the module loads, and never again.
The page has a clock that updates App's state every second. Each render of <JqxGrid> passes its options again: jqwidgets-scripts 27.2.0 applies the ones whose content changed, 27.1.0 the ones whose reference changed, and earlier versions all of them. A new source, in any version, binds all 100,000 rows again. The grid is therefore in a memoized component whose props never change:
// A fixed height: the grid then creates elements only for the rows in view and reuses them as
// you scroll. (autoheight would create one for every row of the page.)
const QuotesGrid = memo(function QuotesGrid({ ref }: { ref: Ref<JqxGrid> }) {
return (
<JqxGrid
ref={ref}
width={'100%'}
height={520}
theme={'material-purple'}
source={source}
columns={columns}
sortable={true}
filterable={true}
columnsresize={true}
/>
);
});
Check the same in your own components. Create source once, outside the component or with useMemo: in every version, a new jqx.dataAdapter(…) in the render is new on every render. Make the props of a memoized component, event handlers included, outside the component or with useCallback, or memo() renders it again. Before 27.2.0, create columns and every other object or array prop once too: an inline columns={[…]} is a new value on every render. From 27.2.0, columns and other plain objects written in the render are compared by content.
To change a few values, set the cells: setcellvalue for each changed cell, between beginupdate() and endupdate() so that the grid draws once. getrowboundindexbyid finds a row's index from its id. Measured in this example, twenty rows take about 20 milliseconds. One updaterow call per row took more than a second (still so in 27.2.0, also between beginupdate and endupdate), and a new source would bind all the rows again.
The rows prop of 27.2.0 (Data from React state) sits in between. With a rowKey, a new array updates only the changed rows, all in one updaterow call, so the grid refreshes its data once. With 100,000 rows, a new array with 20 changed rows took about 0.3 seconds in Chromium, render included; with 20,000 rows, about 25 ms. That suits edits and occasional changes. For a feed like this one, which changes rows every second, set the cells.
// Twenty of the watched rows change each second. Only the changed cells are set, inside one
// beginupdate/endupdate pair, so the grid draws once for all of them. (Measured with
// 100,000 rows: about 20 ms. updaterow for each row took over a second; a new source
// would bind all 100,000 rows again.)
const tick = useCallback(() => {
const g = grid.current;
if (!g) {
return;
}
const started = performance.now();
g.beginupdate();
for (let n = 0; n < 20; n++) {
const id = String(1 + Math.floor(Math.random() * WATCHED));
const index = g.getrowboundindexbyid(id);
const change = Math.round((Math.random() - 0.5) * 200) / 100;
g.setcellvalue(index, 'price', Math.max(1, g.getcellvalue(index, 'price') + change));
g.setcellvalue(index, 'change', change);
}
g.endupdate();
setLastUpdate(`20 rows updated in ${(performance.now() - started).toFixed(1)} ms`);
}, []);
The Change column colours itself with cellclassname. Save the two classes as src/quotes.css:
.up { color: #15803d !important; }
.down { color: #b91c1c !important; }
import { memo, useCallback, useEffect, useRef, useState, type Ref } from 'react';
import JqxGrid, { type IGridProps, jqx } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxgrid';
import './quotes.css';
interface Quote {
id: number;
symbol: string;
exchange: string;
price: number;
change: number;
volume: number;
}
const ROWS = 100_000;
// The live feed moves the prices of the first 200 symbols, the ones in view.
const WATCHED = 200;
const exchanges = ['NYSE', 'NASDAQ', 'LSE', 'XETRA', 'TSE'];
// 100,000 rows, made once when the module loads.
const quotes: Quote[] = Array.from({ length: ROWS }, (_, i) => ({
id: i + 1,
symbol: `SYM${String(i + 1).padStart(6, '0')}`,
exchange: exchanges[i % exchanges.length],
price: Math.round((10 + ((i * 7919) % 99000) / 100) * 100) / 100,
change: 0,
volume: (i * 104729) % 5_000_000
}));
const source = new jqx.dataAdapter({
localdata: quotes,
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'symbol', type: 'string' },
{ name: 'exchange', type: 'string' },
{ name: 'price', type: 'number' },
{ name: 'change', type: 'number' },
{ name: 'volume', type: 'number' }
]
});
const columns: IGridProps['columns'] = [
{ text: 'Symbol', datafield: 'symbol', width: 140 },
{ text: 'Exchange', datafield: 'exchange', width: 110 },
{ text: 'Price', datafield: 'price', width: 120, cellsformat: 'f2', cellsalign: 'right', align: 'right' },
{
text: 'Change', datafield: 'change', width: 110, cellsformat: 'f2', cellsalign: 'right', align: 'right',
cellclassname: (_row: number, _field: string, value: number) => (value > 0 ? 'up' : value < 0 ? 'down' : '')
},
{ text: 'Volume', datafield: 'volume', cellsformat: 'n0', cellsalign: 'right', align: 'right' }
];
// A fixed height: the grid then creates elements only for the rows in view and reuses them as
// you scroll. (autoheight would create one for every row of the page.)
const QuotesGrid = memo(function QuotesGrid({ ref }: { ref: Ref<JqxGrid> }) {
return (
<JqxGrid
ref={ref}
width={'100%'}
height={520}
theme={'material-purple'}
source={source}
columns={columns}
sortable={true}
filterable={true}
columnsresize={true}
/>
);
});
function App() {
const grid = useRef<JqxGrid>(null);
const [live, setLive] = useState(false);
const [lastUpdate, setLastUpdate] = useState('');
const [now, setNow] = useState(() => new Date());
// The clock re-renders App every second. QuotesGrid is memoized and its props never
// change, so the grid itself is not touched.
useEffect(() => {
const timer = setInterval(() => setNow(new Date()), 1000);
return () => clearInterval(timer);
}, []);
// Twenty of the watched rows change each second. Only the changed cells are set, inside one
// beginupdate/endupdate pair, so the grid draws once for all of them. (Measured with
// 100,000 rows: about 20 ms. updaterow for each row took over a second; a new source
// would bind all 100,000 rows again.)
const tick = useCallback(() => {
const g = grid.current;
if (!g) {
return;
}
const started = performance.now();
g.beginupdate();
for (let n = 0; n < 20; n++) {
const id = String(1 + Math.floor(Math.random() * WATCHED));
const index = g.getrowboundindexbyid(id);
const change = Math.round((Math.random() - 0.5) * 200) / 100;
g.setcellvalue(index, 'price', Math.max(1, g.getcellvalue(index, 'price') + change));
g.setcellvalue(index, 'change', change);
}
g.endupdate();
setLastUpdate(`20 rows updated in ${(performance.now() - started).toFixed(1)} ms`);
}, []);
useEffect(() => {
if (!live) {
return;
}
const timer = setInterval(tick, 1000);
return () => clearInterval(timer);
}, [live, tick]);
return (
<main style={{ padding: 16 }}>
<h1>Quotes</h1>
<p>
{ROWS.toLocaleString('en-US')} rows · {now.toLocaleTimeString()}{' '}
<button onClick={() => setLive((v) => !v)}>{live ? 'Stop live updates' : 'Start live updates'}</button>{' '}
<span aria-live="off">{lastUpdate}</span>
</p>
<QuotesGrid ref={grid} />
</main>
);
}
export default App;
The grid opens at once with 100,000 rows, and scrolling, sorting and filtering work on all of them. Start live updates moves twenty of the first two hundred prices each second, and the line next to the button gives the time each update took.
rows prop, and what it costs to change a row