Performance/Virtualization
Performance / Topic

Virtualization

Learn how virtualization improves rendering performance by displaying only the visible portion of large lists or tables.

Difficulty

Advanced

Read time

18 min

Format

Concept + Code

Focus

Interview ready
Concepts
Virtualization
Rendering
Performance

01 / Foundation

Understand the concept

Rendering thousands of DOM elements at once can significantly slow down an application.

Virtualization renders only the items currently visible in the viewport while efficiently reusing DOM nodes during scrolling.

02 / Implementation

Virtualized List

virtualization.tsx
import { FixedSizeList } from "react-window";

const Row = ({ index, style }) => (
  <div style={style}>Item {index}</div>
);

export default function App() {
  return (
    <FixedSizeList
      height={400}
      width={300}
      itemCount={10000}
      itemSize={35}
    >
      {Row}
    </FixedSizeList>
  );
}

04 / Interview

Test your understanding