Next.js Discord

Discord Forum

Preloading component

Unanswered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
I want to build a preloader component that downloads all my images and 3d animations that I get from spline. How can I do this? If I use a regular useState than it won't download ALL the images that are shown within the website. Some of my images are at the bottom of the page. I need something like this:

https://yasingenc.net/
https://museos.arteyeducacion.org/en

2 Replies

American Curl
If you use next/image you can preload images by setting a high priority:
https://nextjs.org/docs/app/api-reference/components/image#priority
I would measure the performance impact tho as many preloaded images might interfere with your other important assets being loaded
Spectacled CaimanOP
Ah I see thanks