
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-lazy-load
Advanced tools
React Lazy Load is easy to use React component which helps you defer loading content in predictable way. It's fast, works in IE8+, 6KB minified and uses debounce function by default. You can also use component inside scrolling container, such as div with scrollbar. It will be found automatically. Check out an example.
React Lazy Load requires React 0.14 or later.
npm install --save react-lazy-load
import React from 'react';
import LazyLoad from 'react-lazy-load';
const MyComponent = () => (
<div>
Scroll to load images.
<div className="filler" />
<LazyLoad height={762} offsetVertical={300}>
<img src='http://apod.nasa.gov/apod/image/1502/HDR_MVMQ20Feb2015ouellet1024.jpg' />
</LazyLoad>
<div className="filler" />
<LazyLoad height={683} offsetTop={200}>
<img src='http://apod.nasa.gov/apod/image/1502/2015_02_20_conj_bourque1024.jpg' />
</LazyLoad>
<div className="filler" />
<LazyLoad height={480} offsetHorizontal={50}>
<img src='http://apod.nasa.gov/apod/image/1502/MarsPlume_jaeschke_480.gif' />
</LazyLoad>
<div className="filler" />
<LazyLoad
height={720}
onContentVisible={() => console.log('look ma I have been lazyloaded!')}
>
<img src='http://apod.nasa.gov/apod/image/1502/ToadSky_Lane_1080_annotated.jpg' />
</LazyLoad>
<div className="filler" />
</div>
);
Type: Number|String Default: 0
Aliases: threshold
The offset option allows you to specify how far below, above, to the left, and to the right of the viewport you want to begin displaying your content. If you specify 0, your content will be displayed as soon as it is visible in the viewport, if you want to load 1000px below or above the viewport, use 1000.
Type: Number|String Default: offset's value
The offsetVertical option allows you to specify how far above and below the viewport you want to begin displaying your content.
Type: Number|String Default: offset's value
The offsetHorizontal option allows you to specify how far to the left and right of the viewport you want to begin displaying your contet.
Type: Number|String Default: offsetVertical's value
The offsetTop option allows you to specify how far above the viewport you want to begin displaying your content.
Type: Number|String Default: offsetVertical's value
The offsetBottom option allows you to specify how far below the viewport you want to begin displaying your content.
Type: Number|String Default: offsetVertical's value
The offsetLeft option allows you to specify how far to left of the viewport you want to begin displaying your content.
Type: Number|String Default: offsetVertical's value
The offsetRight option allows you to specify how far to the right of the viewport you want to begin displaying your content.
Type: Number|String Default: 250
The throttle is managed by an internal function that prevents performance issues from continuous firing of scroll events. Using a throttle will set a small timeout when the user scrolls and will keep throttling until the user stops. The default is 250 milliseconds.
Type: Boolean Default: true
By default the throttling function is actually a debounce function so that the checking function is only triggered after a user stops scrolling. To use traditional throttling where it will only check the loadable content every throttle milliseconds, set debounce to false.
Type: String|Number
The height option allows you to set the element's height even when it has no content.
Type: String|Number
The width option allows you to set the element's width even when it has no content.
Type Function
A callback function to execute when the content appears on the screen.
FAQs
Simple lazy loading component built with react
The npm package react-lazy-load receives a total of 141,195 weekly downloads. As such, react-lazy-load popularity was classified as popular.
We found that react-lazy-load demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.