npm / react-window
react-window
What changed in react-window 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-21.
3 breaking14 new APIs and options6 performance4 behavior and defaults1 tooling19 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-window 247 changes
Breaking changes 3
Version 2 uses List in place of FixedSizeList, with rowComponent, rowCount, rowHeight, and rowProps props in the upgrade example.
Peer dependencies now require React version 18 or newer.
A ResizeObserver primitive or polyfill is required unless explicit pixel dimensions are provided via the style prop.
New APIs and options 14
Supports behavior: "smooth" for dynamic row heights; useVirtualizer's scrollToIndex supports it as well.
List and Grid accept scrollElement to scroll with the page or an ancestor element, rendering only rows visible within that element’s viewport.
Adds a hook for tracking whether a list, grid, or scroll element is scrolling.
Adds a hook for custom headless virtualized content that returns items, total size, visible range, and a scrollToIndex method.
Adds a prop to set the initial horizontal scroll position, applied after hydration unless the browser has already restored a scroll position.
Adds a prop to set the initial vertical scroll position, applied after hydration unless the browser has already restored a scroll position.
Adds a prop to set the initial scroll position, applied after hydration unless the browser has already restored a scroll position.
Adds an option for providing row heights known or estimated ahead of time, such as during server rendering.
Accepts an optional ownerDocument parameter and caches the measured size separately for each document.
Grid accepts an optional columnKey prop.
List accepts an optional rowKey prop.
Grid accepts an optional rowKey prop.
Use the defaultHeight prop to server render the initial set of rows.
Use the defaultWidth prop to server render the initial set of cells.
Performance 6
Rendering no longer computes and caches bounds for every item when fixed-size rows or columns have size 0.
Fixes unnecessary size calculations when scrolling beyond cached bounds.
Avoids allocating bounds for items preceding fixed-size jumps.
Calculates fixed-size visible ranges directly and searches cached variable-size bounds instead of scanning from the beginning.
Row and cell renderers, along with props and context, are automatically memoized.
Version 2 offers a smaller bundle size.
Behavior and default changes 4
List and Grid now have displayName values for React DevTools and error messages in minified builds, without preventing bundlers from tree shaking unused components.
List, Grid, and useDynamicRowHeight use the ResizeObserver, requestAnimationFrame, and document belonging to the window containing the list, supporting rendering into another window such as an iframe or portal pop-up.
Uses fractional percentage sizing.
Grid now supports automatic sizing, so AutoSizer is no longer needed.
Tooling 1
TypeScript support is native, so the separate @types/react-window package is no longer needed.
Fixes and other changes 19
List identifies rows by aria-posinset so additional children and rows that render nothing do not affect row measurement or subsequent indices. Spread ariaAttributes onto every row or none.
Corrections for a scroll requested while the page is hidden no longer time out before the page becomes visible again.
Scrolling to a row, column, or cell now respects the CSS scroll-padding of the element being scrolled.
Invalid sizes, such as percentage strings that cannot be parsed or negative values, are treated as 0.
When fixed-size rows or columns have size 0, only the first item is rendered instead of the last items or every item when the scroll offset was negative.
Server-rendered rows with dynamic heights remain in normal document flow until measured, avoiding overlap or gaps before hydration.
No longer throws when called during server rendering; it now returns 0.
Fixes List and Grid logging useLayoutEffect warnings when server rendered with React 18.
Rows with an aria-hidden attribute are now measured.
Fixes center alignment near list boundaries.
Fixes dropped prop updates.
Fixes stale row measurements when rows are reordered by key.
Fixes scrolling and alignment in RTL layouts.
Improves scrollToRow accuracy for rows with dynamic heights.
Grid updates its direction when the dir prop changes after mount.
useDynamicRowHeight no longer instantiates ResizeObserver when server-rendering.
Imperative scroll-to methods throw a RangeError instead of a regular Error when passed an invalid index.
The return type is explicitly annotated as ReactElement to fix TypeScript warnings for React versions 18.0–18.2.
Adjust the TypeScript return type to work around a ReactNode versus ReactElement mismatch caused by #875.