simple-react-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

simple-react-image is a React component of <img> tag, to gracefully loading large images. Additionally it accepts two optional props, fallback and errorImage. Fallback will be displayed when image will be loading and errorImage will be displyed on any error happend while loading image

demo image

Install

npm install --save simple-react-image

or,

yarn add simple-react-image
Prop type desciption required
fallback string loading image no
errorImage string image on error no
onStateChange function called on loading state change no

all img tags props

Usage

import { Image as Img } from 'simple-react-image';

  <Img
    src={"https://images.pexels.com/photos/813011/pexels-photo-813011.jpeg"}
    />

  <Img
    src={"https://images.pexels.com/photos/813011/pexels-photo-813011.jpeg"}
    fallback="loading image url"
    errorImage='image displyed on error'
    onStateChange={(state)=>{
      console.log(state)
    }}
    />

Demo

Check Demo here

Package Sidebar

Install

npm i simple-react-image

Weekly Downloads

6

Version

1.0.13

License

MIT

Unpacked Size

42.6 kB

Total Files

18

Last publish

Collaborators

  • umar_js