0.0.2 • Published 8 years ago

react-preload-background v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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

proptypenotes
imgstringRemote image to be loaded
placeholderstringLocal image to be immediately displayed

License

MIT License