Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rawrmaan/react-lazy-load

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rawrmaan/react-lazy-load

Simple lazy loading component built with react

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Lazy Load Component

Really simple component that renders children elements when they enter the viewport.

build status dependency status npm downloads

Installation

React Lazy Load requires React 0.14 or later.

npm install --save react-lazy-load

Examples

  • Basic

Usage

import React, { Component } from 'react';
import LazyLoad from 'react-lazy-load';

class MyComponent extends Component {
  render() {
    return (
      <LazyLoad>
        <div>some content</div>
      </LazyLoad>
    );
  }
}

Props

height={String|Number}

This is used to set the elements height even when it contains no content.

<LazyLoad height={100}>
  <div>some content</div>
</LazyLoad>

threshold={Number}

By default content is loaded when it appears on the screen. If you want content to load earlier use threshold parameter. Setting threshold to 200 causes image to load 200 pixels before it appears on viewport.

<LazyLoad threshold={200}>
  <div>some content</div>
</LazyLoad>

onContentVisible={Function}

A callback function to execute when the content appears on the screen.

<LazyLoad onContentVisible={() => { console.log('content visible'); }}>
  <div>some content</div>
</LazyLoad>

Keywords

FAQs

Package last updated on 11 Jan 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc