[Next.js Image Component] Cache Images between pages
I'm using Tanstack Query to dynamically fetch data that includes an image URL, which I then load using the
<Image />
component. On a different page, I fetch new data, but the image URL is often the same as the one on the previous page. The issue is that the same image gets loaded twice. Is there a way to reuse the image across both pages to avoid reloading it?4 Replies
I think, cache-policy should already take care of that in a production build, unless you are using
optimize={false}
or have Disable cache checked in dev tools
That is is the image url is the samewait, the disable cache is only acitve when the devtools (network tab) are open right?
Not sure about the default, check the Network tab
yeah, ok, i will try it out in a prod build