Don't load all images upfront. Load on demand.
Strategy:
- Load current slide immediately
- Preload adjacent slides ( before, after)
- Load others as user navigates
Implementation:
const shouldLoad = (index) => {
return Math.abs(index - currentIndex) <= 1;
};
{images.map((img, i) => (
shouldLoad(i) ? <img src={img.src} /> : <Placeholder />
))}
Placeholder: Show skeleton or blurred thumbnail while loading.
Preload on hover: Load next image when user hovers over next button.