sveltejs / svelte-virtual-list

A virtual list component for Svelte apps
https://svelte.dev/repl/f78ddd84a1a540a9a40512df39ef751b
Other
688 stars 58 forks source link

Expose index #61

Closed Ivo-Evans closed 2 years ago

Ivo-Evans commented 2 years ago

Relates #37 #40 #18

Tested on Svelte ^3.46.2 with a list of 1,533 items - it rendered OK, but if folks are troubled by the performance of iterating through the list beforehand, maybe there's some other solution. It could be an option that the user opts in to, for instance.

Use it like this

  <VirtualList items={statements} let:item let:absoluteIndex>
    <Statement {...item} index={absoluteIndex} />
  </VirtualList>