preload

Hints the browser to download a resource it will soon need.

Since React 19 Spec ↗

Syntax

preload(href, options)

Parameters

NameTypeRequiredDescription
href string Yes URL of the resource to preload.
options object Yes Resource descriptor; must include the as field (style, script, font, image, etc.).

Returns

undefined — preload returns nothing.

Examples

import { preload } from 'react-dom';

function init() {
  preload('/fonts/inter.woff2', {
    as: 'font',
    type: 'font/woff2',
    crossOrigin: 'anonymous',
  });
}

Notes

Emits a `<link rel="preload">` so the browser fetches the resource early without executing it. Call it from event handlers, render, or effects; React deduplicates identical calls. Use preinit instead when you also want the resource to execute immediately.

See also