lazysizes
seems to simple to use, but I can't get it to actually lazy load an image with react... it loads the bottom image thats out of the viewport before it's scrolled into view, as you can see in this minimal codesandbox example.
const id = Math.floor(Math.random() * 500);
<img
style={{ width: 500, height: 500 }}
src={`https://picsum.photos/id/${id}/20`}
data-src={`https://picsum.photos/id/${id}/1000`}
className="lazyload blur-up"
alt=""
/>
.blur-up {
-webkit-filter: blur(30px);
filter: blur(30px);
transition: filter 400ms, -webkit-filter 400ms;
}
.blur-up.lazyloaded {
-webkit-filter: blur(0);
filter: blur(0);
}
(this code is copied almost exactly from the lazysizes docs)
What am I doing wrong?