Search code examples
javascriptreactjsreact-usememo

React re-downloads image after every render


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!


Solution

  • 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)