我正在尝试实现react-window 但我不确定如何传入一个包含它自己的属性的组件
如果我有这样的事情
{
items.map(
(item, index) => {
<MyComponent
key={key}
item={item}
/>;
}
);
}
如何制作变量列表?
该示例未显示如何执行此操作
import { VariableSizeList as List } from 'react-window';
// These row heights are arbitrary.
// Yours should be based on the content of the row.
const rowHeights = new Array(1000)
.fill(true)
.map(() => 25 + Math.round(Math.random() * 50));
const getItemSize = index => rowHeights[index];
const Row = ({ index, style }) => (
<div style={style}>Row {index}</div>
);
const Example = () => (
<List
height={150}
itemCount={1000}
itemSize={getItemSize}
width={300}
>
{Row}
</List>
);