Performance: Image component and optimization
HIGH IMPACT
This affects page load speed by optimizing image delivery and reduces layout shifts by reserving space for images.
import Image from 'next/image'; <Image src="/photo.jpg" alt="Photo" width={800} height={600} priority />
<img src="/photo.jpg" alt="Photo" style={{ width: '100%' }} />
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Standard <img> tag with full-size image | Minimal DOM nodes | Multiple reflows due to layout shifts | High paint cost from large images | [X] Bad |
| Next.js Image component with fixed size and lazy loading | Minimal DOM nodes | Single reflow due to reserved space | Lower paint cost from optimized images | [OK] Good |