react-intersection-images
v0.4.0
Published
React lazy loading images with Intersection Observer
Downloads
722
Readme
React Lazy Images
React lazy load images with IntersectionObserver.
Usage
import React from 'react';
import Lazy from "react-lazy-images"
const App = () => {
const placeholder = "https://picsum.photos/id/237/500/300"
const generateImg = () => `https://picsum.photos/id/${Math.floor(Math.random() * 999)}/500/300`
return (
<div>
<Lazy placeholder={placeholder} force={true} src={generateImg()} ratio={0.1} />
<Lazy placeholder={placeholder} src={generateImg()} ratio={0.1} />
<Lazy placeholder={placeholder} src={generateImg()} ratio={0.1} />
<Lazy placeholder={placeholder} src={generateImg()} ratio={0.1} />
<Lazy placeholder={placeholder} src={generateImg()} ratio={0.1} />
<Lazy placeholder={placeholder} src={generateImg()} ratio={0.1} />
</div>
);
}
export default App;