Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › image optimization

How to Lazy Load Images in React Without Delaying the Images That Matter

By Freedom251 Team · · 5 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For ordinary offscreen images, add loading="lazy" to the React <img> element. Keep images visible at initial page load—especially the likely Largest Contentful Paint (LCP) image—eager so the browser can discover and fetch them promptly. Add intrinsic dimensions when known to reserve space and reduce layout shifts.

Use the browser’s native lazy-loading hint

React passes the loading prop to the rendered image. Set it to lazy for an image that is not needed in the initial viewport:

As an Amazon Associate I earn from qualifying purchases.

function ArticleImage() {
  return (
    <img
      src="/images/article-detail.jpg"
      alt="A reader looking at an open book"
      width={1200}
      height={800}
      loading="lazy"
    />
  );
}

The browser decides when to fetch the image as it approaches the viewport; the hint does not require a React library or custom scroll handler. React documents eager as the default and describes loading="lazy" as asking the browser to defer loading until the image approaches the viewport (React <img> reference). MDN likewise describes native lazy loading as deferring offscreen resources until the user scrolls near them (MDN: Lazy loading).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose which images should load lazily

Keep the initial, important image eager

Do not blanket-apply lazy loading to every image. Images already visible when the page opens should normally remain eager, particularly the likely LCP image. Delaying that image can delay its discovery and loading, working against the performance goal. web.dev recommends avoiding lazy loading for images likely to be in the initial viewport (web.dev: Browser-level image lazy loading for the web).

For an image that should load immediately but at lower priority, React documents fetchPriority="low" as a distinct option. In server-rendered React, loading="lazy" prevents React’s automatic preload hint for that image; fetchPriority="low" also opts it out of that preload while retaining immediate loading at lower priority. These are different choices, not interchangeable ways to lazy-load an image (React preload reference).

Lazy-load images below the fold

Use loading="lazy" for images that are not needed until a reader scrolls toward them. The browser controls the precise fetch threshold, so this is a loading hint rather than a guarantee that the request starts at a specific pixel distance.

Reserve image space and choose responsive sources

When dimensions are known, include width and height. The browser can use them to reserve the image’s space before its bytes arrive, helping avoid reflow as content loads. For responsive assets, srcSet and sizes help the browser select an appropriate resource; they complement rather than replace the loading hint (React <img> reference).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<img
  src="/images/landscape-1200.jpg"
  srcSet="/images/landscape-600.jpg 600w, /images/landscape-1200.jpg 1200w"
  sizes="(max-width: 600px) 100vw, 800px"
  alt="Mountain landscape at sunrise"
  width={1200}
  height={800}
  loading="lazy"
/>

Lazy loading defers requests; it does not compress image bytes. If images are still large, address formats, dimensions, and compression separately. MDN treats image compression and making image dimensions knowable as separate fast-page considerations (MDN: Author fast-loading HTML pages).

When to use Intersection Observer instead

For typical offscreen images, start with native loading="lazy". Use the Intersection Observer API when you need custom behavior triggered by visibility—for example, a particular placeholder transition or application-controlled request timing. That adds implementation decisions around placeholders, failed requests, thresholds, and target-browser support. Compare it with the native hint against your actual audience and measured requirements; the cited documentation does not establish a need for a library for an ordinary React page.

Do not confuse image loading with React.lazy(). React’s lazy API defers loading component code until the component is first rendered; the HTML image loading="lazy" hint concerns fetching an image (React lazy reference).

Validate the result on your page

  1. Inspect the initial viewport at representative mobile and desktop sizes. Identify the images visible immediately and the likely LCP image.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Leave those important initial images eager. Add loading="lazy" to images farther down the page.

  3. Add intrinsic width and height when known; keep suitable srcSet and sizes values for responsive images.

  4. Inspect the rendered HTML and browser network panel. Confirm that the important visible image begins loading promptly and that offscreen image requests are deferred as expected.

  5. Compare performance before and after with a consistent test setup. The outcome depends on the actual page and loading conditions; do not assume a speedup without measuring it.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common problems and fixes

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a page image rather than implement lazy loading in your own React UI, ScreenshotNeo provides a screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; the API also supports full-page captures with lazy images loaded. See the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

image optimizationJavaScriptReactweb performance

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.