Gathering detailed insights and metrics for react-lazy-load
Gathering detailed insights and metrics for react-lazy-load
Gathering detailed insights and metrics for react-lazy-load
Gathering detailed insights and metrics for react-lazy-load
react-lazy-load-image-component
React Component to lazy load images using a HOC to track window scroll position.
@types/react-lazy-load-image-component
TypeScript definitions for react-lazy-load-image-component
react-intersection-observer
Monitor if a component is inside the viewport, using IntersectionObserver API
@times-components/lazy-load
Use IntersectionObserver to lazy load resources
React component that renders children elements when they enter the viewport.
npm install react-lazy-load
Typescript
Module System
Node Version
NPM Version
TypeScript (54.57%)
JavaScript (45.43%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
983 Stars
148 Commits
165 Forks
12 Watchers
5 Branches
25 Contributors
Updated on Jun 24, 2025
Latest Version
4.0.1
Package Id
react-lazy-load@4.0.1
Unpacked Size
13.34 kB
Size
5.27 kB
File Count
7
NPM Version
8.1.4
Node Version
18.6.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
19
React Lazy Load is an easy-to-use React component which helps you defer loading content in predictable way. It's fast, You can also use component inside scrolling container, such as div with scrollbar. It will be found automatically. Check out an example.
Converted to work with React 18, and updated to use the Intersection Observer API.
offset={'0px 10px 200px 0px'}
or offset={100}
Since we're now using the intersection observer we don't need to watch a user scroll, more importantly we don't have to manually calculate if a user can see the element or not. Also took this oppourtunity to convert over to TS.
React Lazy Load requires React 17 or later.
npm i -S react-lazy-load
1import React from 'react'; 2import LazyLoad from 'react-lazy-load'; 3 4const MyComponent = () => ( 5 <div> 6 <LazyLoad height={762}> 7 <img src='http://apod.nasa.gov/apod/image/1502/HDR_MVMQ20Feb2015ouellet1024.jpg' /> 8 </LazyLoad> 9 </div> 10)
1const MyComponent = () => ( 2 <div> 3 <LazyLoad height={762} offset={300}> 4 <img src='http://apod.nasa.gov/apod/image/1502/HDR_MVMQ20Feb2015ouellet1024.jpg' /> 5 </LazyLoad> 6 </div> 7)
1const MyComponent = () => ( 2 <div> 3 <LazyLoad height={762} width={400} threshold={0.95}> 4 <img src='http://apod.nasa.gov/apod/image/1502/HDR_MVMQ20Feb2015ouellet1024.jpg' /> 5 </LazyLoad> 6 </div> 7)
1const MyComponent = () => ( 2 <div> 3 <LazyLoad height={762} width={400} threshold={0.95} onContentVisible={() => {console.log('loaded!')}}> 4 <img src='http://apod.nasa.gov/apod/image/1502/HDR_MVMQ20Feb2015ouellet1024.jpg' /> 5 </LazyLoad> 6 </div> 7)
There are two primary classes you an use to control the component LazyLoad
and is-visible
1/* Example of how to fade our content in */ 2 3.LazyLoad { 4 opacity: 0; 5 transition: all 1s ease-in-out; 6} 7 8.is-visible { 9 opacity: 1; 10}
Type: Number|String
Default: 0
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
Default: 0
This threshold
option allows you to specify how much of the element must be shown on the screen prior to loading. This requires a width and height to be set on the <LazyLoad>
component in order for the browser to calcualte the viewable area.
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.
npm run build
cd examples/basic
npm run dev
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 8/13 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More