JSPM

react-preload-background

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q35617F
  • License MIT

This package allows you to display a placeholder image while the actual background image loads

Package Exports

  • react-preload-background

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-preload-background) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-preload-background

This package allows you to show a static preload image while image is preloaded and then transitions

Installation

npm install react-preload-background --save

Usage

  import React from 'react';
  import PreloadBackground from 'react-preload-background';

  export default (props) => {
    const {source, ...otherProps} = props;
    const localImage = '/path/to/local/asset';

    return(
      <PreloadBackground img={source} placeholder={localImage} {...otherProps}>
        <someOtherReactComponent />
      </PreloadBackground>
    );
  }

Props

prop type notes
img string Remote image to be loaded
placeholder string Local image to be immediately displayed

License

MIT License