Skip to content

Instantly share code, notes, and snippets.

View nelsoneldoro's full-sized avatar
💭
I may be slow to respond.

Nelson Eldoro nelsoneldoro

💭
I may be slow to respond.
  • Fortaleza, Ceará, Brazil
View GitHub Profile
@nelsoneldoro
nelsoneldoro / Virtualization.tsx
Created August 20, 2025 02:20
React vanilla virtualization
import { useState } from "react";
const TOTAL = 10000; // number of items
const ITEM_HEIGHT = 30; // fixed height of each item
const VIEWPORT_HEIGHT = 300; // height of the visible container
const BUFFER = 5; // extra safety buffer (before/after)
export default function VirtualizedList() {
const [scrollTop, setScrollTop] = useState(0);