What is react-virtualized-auto-sizer?
The react-virtualized-auto-sizer package is a utility component for React that automatically adjusts the size of its child component to fit the available space. It is commonly used in conjunction with other virtualization libraries to create performant, scrollable lists or grids that can handle large datasets efficiently.
Auto-sizing a child component
This feature allows you to automatically adjust the size of a List component from the react-virtualized library to fit the available space. The AutoSizer component wraps around the List and provides the height and width as props.
```jsx
import React from 'react';
import AutoSizer from 'react-virtualized-auto-sizer';
import { List } from 'react-virtualized';
const MyList = ({ items }) => (
<AutoSizer>
{({ height, width }) => (
<List
height={height}
width={width}
rowCount={items.length}
rowHeight={20}
rowRenderer={({ index, key, style }) => (
<div key={key} style={style}>
{items[index]}
</div>
)}
/>
)}
</AutoSizer>
);
export default MyList;
```