Home > Blockchain >  React re-downloads image after every render
React re-downloads image after every render

Time:03-27

Edit:

The reason for re-downloading of resources was related to cacheing of images - I had previously enabled Disable cache in chrome dev tools, disabling it solved the issue!

CodePudding user response:

You can't fix this with react, you should rather fix it with caching headers on your images.

For each <img src="http://your.url" /> the browser will perform a network request.

The best way to improve performance is to make sure that request has the proper caching headers, so it's not actually downloading the image each time (rather just once)

  • Related