Skip to content
RED SAGSkills
hard20 pts · first answer countsweb-performancerendering

Avoiding layout thrashing

This loop is slow on large lists. Why, and what is the best fix?

items.forEach(el => {
  const h = el.offsetHeight
  el.style.height = h * 2 + 'px'
})
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions