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

react-lzloader

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lzloader

Lazy-Load your components with Intersection Observer

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React-lzloader

styled with prettier Travis

Lazy-Load your components with using Intersection Observer API

Installation

npm install --save react-lzloader

or

yarn add react-lzloader

Usage

import LazyLoad from "react-lzloader";

const App = () => (
  <LazyLoad callback={yourCallbackFunc}>
    {
      (setRef) => (
        <div ref={setRef} />;
      )
    }
  </LazyLoad>
);

This libraries component (LazyLoad) called yourCallbackFunc when the setted up component is in Window.

So you write some actions or functions in callback and set refs in child components of LazyLoad.

Option

interface IntersectionObserverInit {
    root?: Element | null;
    rootMargin?: string;
    threshold?: number | number[];
}

const options: IntersectionObserverInit = {
  root: null,
  rootMargin: '0px',
  threshold: 1.0
}
<LazyLoad callback={yourCallbackFunc} options={options} />

If you want to set more detail intersection options, those intersection observer options to prop the LazyLoad component.

The options are Intersection Observer Options.

Examples

Lazy image load

// TODO

Infinite scroll

// TODO

Keywords

FAQs

Package last updated on 28 Feb 2018

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