Intersection Observer & Efficient Scroll Handling

How can you optimize scroll performance in long lists or tables?
const listObserver = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      const row = entry.target;
      row.style.visibility = 'visible';
      if (row.dataset.src) {
        row.textContent = row.dataset.src;
        delete row.dataset.src;
      }
    } else {
      entry.target.style.visibility = 'hidden';
    }
  });
}, {
  rootMargin: '100px 0px'
});
Next Question (19/20)