3

I'm using React-window - which is a more modern version of react-virtualized - to display a infinite list of images. It works very well with a classic list, but it freezes the ui when used as a grid.

I suspect the reason is that react-window grid does not send back a unique index for each element but a row and/or column index. Long story short, if you display 3 images per row:

  • row 1 => image 1 = index 0, image 2 = index 1, image 3 = index 2
  • row 2 => image 1 = index 0, image 2 = index 1, image 3 = index 2

So items are repeated instead of receiving index 4,5 and 6. Has anyone used the library's grid, and if so, how did you manage to retrieve the correct items in the correct columns?

DoneDeal0
  • 5,273
  • 13
  • 55
  • 114
  • 2
    [Utamakan Belajar](https://stackoverflow.com/users/4306015) posted an [Answer](https://stackoverflow.com/a/67085040) saying "maybe, you could use this method: [https://codesandbox.io/s/1y82x05r6j?file=/index.js:1317-1418](https://codesandbox.io/s/1y82x05r6j?file=/index.js:1317-1418)" – Scratte Apr 19 '21 at 07:59
  • Any updates here? – Taylor A. Leach Oct 20 '22 at 19:51
  • try using this - `const currentIndex = rowIndex * columnCount + columnIndex`. Worked for me. – sohammondal Oct 25 '22 at 11:00

0 Answers0