Lazyload your Component, Image or anything matters the performance.
Work in progress, use at your own risk!!
- Take performance in mind, only 2 event listeners for all lazy-loaded components
- Support both
one-time lazy load
andcontinuous lazy load
mode - IE 8 compatible
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);
Type: Bool Default: false
Once the lazy loaded component is mounted, do not detect scroll/resize event anymore. Useful for images or simple components.
$ npm run demo
$ npm run build
MIT