twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

[Question] How to display placeholder when the image is still be fetched while visible in the viewport? #341

Open nhanpdnguyen opened 3 years ago

nhanpdnguyen commented 3 years ago

Hi guys, I was using this library to lazy-load my images, I was also using my custom placeholder component.

As I observe, as soon as the images are in the viewport, the placeholder will be immediately replaced with the img tag. However, in my case, my image fetching is slow, so the image goes blank for a while until the fetching done and the browser paints it.

So my question is there any way to show the placeholder until the image is completely fetched?

Thank you