Warper is an open-source React virtualization library available on npm.
# Using npm
npm install @itsmeadarsh/warper
# Using yarn
yarn add @itsmeadarsh/warper
# Using pnpm
pnpm add @itsmeadarsh/warper
# Using bun
bun add @itsmeadarsh/warperimport { useVirtualizer } from '@itsmeadarsh/warper';
function MyList() {
const { scrollElementRef, range, totalHeight } = useVirtualizer({
itemCount: 1_000_000,
estimateSize: () => 50,
overscan: 5,
});
return (
<div ref={scrollElementRef} style={{ height: 500, overflow: 'auto' }}>
<div style={{ height: totalHeight, position: 'relative' }}>
{range.items.map((index, i) => (
<div
key={index}
style={{
position: 'absolute',
top: 0,
transform: `translateY(${range.offsets[i]}px)`,
height: range.sizes[i],
width: '100%',
}}
>
Row {index}
</div>
))}
</div>
</div>
);
}import { WarperComponent } from '@itsmeadarsh/warper';
function App() {
return (
<WarperComponent
itemCount={1_000_000}
estimateSize={() => 44}
overscan={5}
>
{(index) => <Row data={items[index]} />}
</WarperComponent>
);
}Warper requires React 18+:
{
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}- Chrome 89+
- Firefox 89+
- Safari 15+
- Edge 89+