Live-updating data grid

A price ticker where rows briefly highlight when their value changes, the same pattern behind trading blotters and live ops dashboards. It's just three ingredients you already have:keyField to identify rows across updates, a small piece of state tracking which rows just changed, and conditionalRowStyles to flash them.

Live-updating price grid

Prices tick every ~1.2s. Rows flash briefly when their price changes.

Symbol
Name
Price
Change
ACME
Acme Corp
$182.40
—
BLTC
Baltic Freight
$64.12
—
CNDL
Candle Systems
$305.90
—
DYNM
Dynamo Energy
$48.77
—
EVRG
Evergreen Foods
$96.30
—

This demo uses Tailwind utility classes for layout. Swap in your own CSS when copying into your project.

Match rows across updates with keyField

When data is replaced on every tick, React (and the table) need a stable identity per row. Set keyField to whichever field uniquely identifies a row:

<DataTable columns={columns} data={data} keyField="symbol" />

Track which rows just changed

Keep a Set of recently-changed keys in state. Add a key when its row updates, then remove it after the flash duration:

const [flashed, setFlashed] = useState<Set<string>>(new Set());

function updatePrice(symbol: string, next: number) {
  setData(prev => prev.map(r => (r.symbol === symbol ? { ...r, price: next } : r)));
  setFlashed(prev => new Set(prev).add(symbol));
  setTimeout(() => setFlashed(prev => {
    const copy = new Set(prev);
    copy.delete(symbol);
    return copy;
  }), 600);
}

Flash the row with conditionalRowStyles

No animation library needed: a CSS transition on the inline style fades the highlight out on its own:

const conditionalRowStyles: ConditionalStyles<Ticker>[] = [
  {
    when: r => flashed.has(r.symbol),
    style: { backgroundColor: '#fefce8', transition: 'background-color 0.6s ease' },
  },
];

<DataTable columns={columns} data={data} keyField="symbol" conditionalRowStyles={conditionalRowStyles} />