react-images-preloader
HOC to preload images before they will be actually rendered
Installation
npm i -D react-images-preloader
Usage
import preloadImages from 'react-images-preloader'; const App = img1 img2 <div> <p>These images are already preloaded</p> <img = = /> <img = = /> </div>; const AppContainer = App;
API
preloadImages(config<Object>, component<React.Component>)
Calling preloadImages
will initiate preloading immediately and pass specified images down to wrapped component via pros. So later when a component will render, images will be already cached by browser.
MIT