Package Exports
- react-background-image-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-background-image-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-background-image-loader
Allows you display a placeholder image while the actual background image loads
Installation
npm install react-background-image-loader --save
Usage
import React from 'react';
import BackgroundImage from 'react-background-image-loader';
export default (props) => {
const {source, ...otherProps} = props;
const localImage = '/path/to/local/asset';
return(
<BackgroundImage img={source} placeholder={localImage} {...otherProps}>
<div className="something-else">
Some more markup
</div>
<SomeOtherReactComponent />
</BackgroundImage>
);
}Props
| prop | type | notes |
|---|---|---|
| img | string | Remote image to be loaded |
| placeholder | string | Local image to be immediately displayed |
License
MIT License