79502714

Date: 2025-03-12 05:38:48
Score: 0.5
Natty:
Report link

When you don't set a fixed height for the inner container, the virtualization engine can't determine which rows are visible, rendering every row in the expanded section. By wrapping the inner list in a container with a specific height (say 300px), you let React Virtualized know how much space it has to work with. Then, using an AutoSizer, it calculates the available width and height, and the List component only renders the rows that fit within that space.

Maybe like this :

{expanded && (
  <div style={{ height: 300 }}>
    <AutoSizer>
      {({ height, width }) => (
        <List
          width={width}
          height={height}
          rowCount={rows.length}
          rowHeight={50}
          rowRenderer={innerRowRenderer}
        />
      )}
    </AutoSizer>
  </div>
)}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When you
  • Low reputation (1):
Posted by: Jaydeep Pipaliya