repreload
v0.1.0
Published
React component for preloading images
Downloads
67
Readme
Repreload
Higher-order component for preloading images with React
Usage
import React from 'react';
import Repreload from 'repreload';
const Img = ({ src, loadStatus }) => (
<div>
{loadStatus === 'loaded' &&
<img src={src} />
}
{loadStatus === 'loading' &&
<span>{'Loading...'}</span>
}
{loadStatus === 'errored' &&
<span>{'Error'}</span>
}
</div>
);
export const PreloadedImg = Repreload({
src: '/path/to/image'
})(Img);
<3
MIT License