Skip to content

Lazy load your component, image or anything matters the performance.

License

Notifications You must be signed in to change notification settings

debraj1990/react-lazyload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-lazyload

Lazyload your Component, Image or anything matters the performance.

Work in progress, use at your own risk!!

Online Demo

Why it's better

  • Take performance in mind, only 2 event listeners for all lazy-loaded components
  • Support both one-time lazy load and continuous lazy load mode
  • IE 8 compatible

Usage

import React from 'react';
import LazyLoad from 'react-lazyload';
import MyComponent from './MyComponent';

const App = React.createClass({
  render() {
    return (
      <div className="list">
        <LazyLoad>
          <MyComponent />
        </LazyLoad>
        <LazyLoad>
          <MyComponent />
        </LazyLoad>
        <LazyLoad>
          <MyComponent />
        </LazyLoad>
        <LazyLoad>
          <MyComponent />
        </LazyLoad>
        <LazyLoad>
          <MyComponent />
        </LazyLoad>
      </div>
    );
  }
});

React.render(<App />, document.body);

Props

Once

Type: Bool Default: false

Once the lazy loaded component is mounted, do not detect scroll/resize event anymore. Useful for images or simple components.

Scripts

$ npm run demo
$ npm run build

License

MIT

About

Lazy load your component, image or anything matters the performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%