react-preload-background

0.0.2 • Public • Published

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

/react-preload-background/

    Package Sidebar

    Install

    npm i react-preload-background

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • nicholas.b.carter