Description
react-lazy-load is a React component that defers loading content until it is needed. Its children render when they enter the viewport, so you can delay images and other heavy content until the user scrolls to them. It also works inside scrolling containers, such as a div with a scrollbar, and the README says the scroll container is found automatically. Version 4.0 was updated to work with React 18 and uses the Intersection Observer API, so the component no longer has to watch scroll events and calculate visibility by hand. The code was converted to TypeScript. The offset prop works like CSS margin and sets how far outside the viewport content starts to display, while the threshold prop sets how much of the element must be visible, such as 95 percent. The README shows examples for basic use, loading an image 300px before scroll, running a side effect once content has loaded, and styling the transition with the LazyLoad and is-visible classes. The component requires React 17 or later.…
Highlights
- Renders children when they enter the viewport
- Works inside scrolling containers
- Uses the Intersection Observer API, written in TypeScript
- Offset and threshold props
- Requires React 17 or later
Ratings & Reviews
No ratings yet
Be the first to rate react-lazy-load.
People also visit

react-lazyload
Lazyload your Component, Image or anything else where the performance matters

react-on-screen
A wrapper component to track if your react component is visible on screen

react-lazy-load-image-component
React Component to lazy load images using a HOC to track window scroll position

react-waypoint
A React component to execute a function whenever you scroll to an element
react-lazy-load FAQ
What does react-lazy-load do?
It defers loading content in React. Children render only when they enter the viewport, which suits images and other heavy content.
Does it work inside a scrollable div?
Yes. It can be used inside a scrolling container, such as a div with a scrollbar, and the README says the container is found automatically.
How do I load content before it is visible?
Use the offset prop. It works like CSS margin, and a number such as 1000 starts displaying content 1000px before it reaches the viewport.
Which React version does it need?
React 17 or later. Version 4.0 was updated to work with React 18.
What changed in version 4.0?
It switched to the Intersection Observer API, dropped the debounce and throttle options, and replaced the individual offset props with one offset that works like CSS margin.
What are the best react-lazy-load alternatives?
Popular alternatives to react-lazy-load include react-lazyload, react-on-screen and react-visibility-sensor. See all react-lazy-load alternatives
















