prefetchDNS

Hints the browser to resolve DNS for a host it will likely contact.

Since React 19 Spec ↗

Syntax

prefetchDNS(href)

Parameters

NameTypeRequiredDescription
href string Yes The origin URL whose DNS should be resolved ahead of time.

Returns

undefined — prefetchDNS returns nothing.

Examples

import { prefetchDNS } from 'react-dom';

function App() {
  prefetchDNS('https://api.example.com');
  return <Main />;
}

Notes

Emits a `<link rel="dns-prefetch">` to resolve a hostname early, shaving latency from a later request. Cheaper than preconnect; use preconnect when you are confident a connection (including TLS) will be needed soon. React deduplicates repeated calls for the same origin.

See also