0.2.2 • Published 12 months ago
@dims/virtualist v0.2.2
Virtualist
By using useVirtualist
hook, you can create a virtualized list that efficiently renders only the visible portion of the list based on the scroll position, improving performance when dealing with large lists of items.
- Much simpler than popular solutions.
- No pain when dealing with rows with varying heights.
- Use the onScroll callback directly to initiate infinite loading.
- Designed as a hook to provide maximum flexibility for customization.
Options
Option | Default Value | Description |
---|---|---|
records | N/A | An array of DB records to be rendered in the virtualized list. |
listHeight | 500 | The height of the list container in pixels. |
itemHeight | 50 | The placeholder height of each item before it is rendered. |
onScroll | N/A | A callback function triggered when the list is scrolled. |
throttle | 50 | The delay in milliseconds to debounce the scroll event. |
renderOffset | 400 | The additional offset in pixels to render items outside the visible area. |
TODO
- benchmarks
- add tests
- extend examples