Home / Function/ prefetchDNS() — react Function Reference

prefetchDNS() — react Function Reference

Architecture documentation for the prefetchDNS() function in ReactDOMFloat.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  93a06b1f_f85f_8382_cf82_eb484cb62c48["prefetchDNS()"]
  3ea12e77_bd9c_ec2a_fb3c_db692f520137["ReactDOMFloat.js"]
  93a06b1f_f85f_8382_cf82_eb484cb62c48 -->|defined in| 3ea12e77_bd9c_ec2a_fb3c_db692f520137
  24cdce56_f095_bb7e_3cbd_6bc0a497e302["getValueDescriptorExpectingObjectForWarning()"]
  93a06b1f_f85f_8382_cf82_eb484cb62c48 -->|calls| 24cdce56_f095_bb7e_3cbd_6bc0a497e302
  8ae8338e_757b_2763_77d2_0bd8938bd5bd["getValueDescriptorExpectingEnumForWarning()"]
  93a06b1f_f85f_8382_cf82_eb484cb62c48 -->|calls| 8ae8338e_757b_2763_77d2_0bd8938bd5bd
  style 93a06b1f_f85f_8382_cf82_eb484cb62c48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom/src/shared/ReactDOMFloat.js lines 24–56

export function prefetchDNS(href: string) {
  if (__DEV__) {
    if (typeof href !== 'string' || !href) {
      console.error(
        'ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.',
        getValueDescriptorExpectingObjectForWarning(href),
      );
    } else if (arguments.length > 1) {
      const options = arguments[1];
      if (
        typeof options === 'object' &&
        options.hasOwnProperty('crossOrigin')
      ) {
        console.error(
          'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
          getValueDescriptorExpectingEnumForWarning(options),
        );
      } else {
        console.error(
          'ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.',
          getValueDescriptorExpectingEnumForWarning(options),
        );
      }
    }
  }
  if (typeof href === 'string') {
    ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */
      .D(/* prefetchDNS */ href);
  }
  // We don't error because preconnect needs to be resilient to being called in a variety of scopes
  // and the runtime may not be capable of responding. The function is optimistic and not critical
  // so we favor silent bailout over warning or erroring.
}

Domain

Subdomains

Frequently Asked Questions

What does prefetchDNS() do?
prefetchDNS() is a function in the react codebase, defined in packages/react-dom/src/shared/ReactDOMFloat.js.
Where is prefetchDNS() defined?
prefetchDNS() is defined in packages/react-dom/src/shared/ReactDOMFloat.js at line 24.
What does prefetchDNS() call?
prefetchDNS() calls 2 function(s): getValueDescriptorExpectingEnumForWarning, getValueDescriptorExpectingObjectForWarning.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free