Socket
Socket
Sign inDemoInstall

react-lazilyload-img

Package Overview
Dependencies
11
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-lazilyload-img

Simple react.js component for lazy load your images


Version published
Weekly downloads
54
increased by20%
Maintainers
1
Install size
1.56 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 11 Jun 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc