Images keep downloading after re-render #153
-
How do you handle the situation when we load still the old images and the new ones after rerender the component? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not sure you can abort network requests in this case. Once the DOM gets updated with new images, it's up to the browser to cancel the mid-flight network requests (and it looks like most popular browsers don't do that). In this case, you can minimize network bandwidth waste by providing multiple images of various resolutions in the |
Beta Was this translation helpful? Give feedback.
I'm not sure you can abort network requests in this case. Once the DOM gets updated with new images, it's up to the browser to cancel the mid-flight network requests (and it looks like most popular browsers don't do that). In this case, you can minimize network bandwidth waste by providing multiple images of various resolutions in the
srcSet
prop so that your browser can pick the most appropriate image resolution for your current viewport size.