react-img-preloader
v2.1.1
Published
making images preloading dead-simple, additionally, offering both the total count of images aimed for preloading and the count of those have been preloaded, to ease the work if anyone fancy to show a running progress bar.
Downloads
9
Maintainers
Readme
npm install react-img-preloader --save
import ImgPreloader from 'react-img-preloader'
// gather up all images you want for preload in an array
var images = [
require('/your/path/to/img1'),
require('/your/path/to/img2'),
require('/your/path/to/img3'),
// ... more goes here
]
<ImgPreloader imgs={images} onComplete={() => {
console.log('All images are loaded')
}}>
{
({loaded, total}) => <div>imgages planned for preload: {total}; images have been preloaded: {loaded}</div>
}
</ImgPreloader>