0.1.0 • Published 7 years ago

repreload v0.1.0

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

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

0.1.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago