-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Thinking about the possibility of replacing the HoC technique with the render prop technique.
The syntax would go from:
const MyVirtualList = VirtualList()(MyList);
return (
<MyVirtualList
items={myBigListOfItems}
itemHeight={100}
/>
);to
return (
<VirtualList
items={myBigListOfItems}
itemHeight={itemHeight}
renderVirtual={({ items, style} => (
<ul style={style}>
{items.map(item => (
<li key={`item_${item.id}`} style={{height: itemHeight}}>
Lorem ipsum dolor sit amet
</li>
))}
</ul>
))}
/>
);Alternatively it could be function as children:
return (
<VirtualList
items={myBigListOfItems}
itemHeight={itemHeight}
>
{({ items, style } => (
<ul style={style}>
{items.map(item => (
<li key={`item_${item.id}`} style={{height: itemHeight}}>
Lorem ipsum dolor sit amet
</li>
))}
</ul>
))}
</VirtualList>
);Any thoughts?
Metadata
Metadata
Assignees
Labels
No labels