From 45303e317dcde8c1919f281571917c4a78893295 Mon Sep 17 00:00:00 2001 From: Kirill Grevtsov Date: Tue, 21 Jan 2020 21:17:59 +0200 Subject: [PATCH] Render image once to prevent double downloading --- src/components/LazyLoadImage.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/LazyLoadImage.jsx b/src/components/LazyLoadImage.jsx index 39a3317..37e3e93 100644 --- a/src/components/LazyLoadImage.jsx +++ b/src/components/LazyLoadImage.jsx @@ -122,10 +122,9 @@ class LazyLoadImage extends React.Component { render() { const { effect, placeholderSrc, visibleByDefault } = this.props; - const { loaded } = this.state; const image = this.getImg(); - const lazyLoadImage = loaded ? image : this.getLazyLoadImage(image); + const lazyLoadImage = this.getLazyLoadImage(image); if ((!effect && !placeholderSrc) || visibleByDefault) { return lazyLoadImage;