2.1.6 • Published 3 years ago

react-lazilyload-img v2.1.6

Weekly downloads
130
License
MIT
Repository
github
Last release
3 years ago

react-lazilyload-img

npm version npm bundle size GitHub license

Simple && small React.js component for lazy load images

Table of contents

Installation

npm

npm install react-lazilyload-img --save

yarn

yarn add react-lazilyload-img

Usage

Basic Example:

import React, { Component } from 'react';
import Img from 'react-lazilyload-img';

const App = () => {
  return(
    <Img
      src="//images.unsplash.com/photo-1539250632877-c12b7d5d6fcb"
      placeholderSrc="//images.unsplash.com/photo-1539250632877-c12b7d5d6fcb?w=27&q=8"
    >
  );
};

Props

NameTypeDefault ValueDescription
classNamestring''image className
loadingClassNamestring''className for main image in loading state (applied when main image start loading and delete after loading end)
mainImgClassNamestring''className for main image (applied when main image start loading)
mainImgOnLoadfuncnullfunction that will be called after main image load end
onLoadfuncnullfunction that will be called after placeholder image or main image load end
placeholderClassNamestring''placeholder image className (deleted before main image start loading)
placeholderOnLoadfuncnullfunction that will be called after placeholder image load end
placeholderSrcstring''placeholder image src attr value
placeholderSrcSetstring''placeholder image srcset attr value
srcstring''main image src attr value
srcSetstring''main image srcset attr value
...any other image attributes

Demo

npm.io

2.1.6

3 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

1.0.1

5 years ago

1.0.0-alpha

6 years ago