Capítulo 10 de 20
This example supplies a known size for each row or column, and also shows two-axis grids and four-lane masonry layouts. The sizes come from data rather than DOM measurement.
const rowVirtualizer = useVirtualizer({
count: rows.length,
getScrollElement: () => parentRef.current,
estimateSize: (i) => rows[i],
overscan: 5,
})
const columnVirtualizer = useVirtualizer({
horizontal: true,
count: columns.length,
getScrollElement: () => parentRef.current,
estimateSize: (i) => columns[i],
overscan: 5,
})
estimateSize when sizes are known before render.lanes: 4 for the example's masonry-style distribution and use each item's lane for placement.