Home / Function/ diffHydratedGenericElement() — react Function Reference

diffHydratedGenericElement() — react Function Reference

Architecture documentation for the diffHydratedGenericElement() function in ReactDOMComponent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  409bfd4f_a0a2_7b82_31de_9321ab006da0["diffHydratedGenericElement()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  3246fe42_26b8_0630_2d76_6dda95625fe3["diffHydratedProperties()"]
  3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| 409bfd4f_a0a2_7b82_31de_9321ab006da0
  b98b4c7e_a5fc_744a_2478_0278e64cf8e0["warnForInvalidEventListener()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| b98b4c7e_a5fc_744a_2478_0278e64cf8e0
  befb3c8a_925e_b969_cf38_442509b5162d["warnForPropDifference()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| befb3c8a_925e_b969_cf38_442509b5162d
  e6b16ab1_66ce_997c_25dd_60a9670e673b["normalizeHTML()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| e6b16ab1_66ce_997c_25dd_60a9670e673b
  5a761d37_2f45_4932_7fe3_a541d80b141d["hydrateAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| 5a761d37_2f45_4932_7fe3_a541d80b141d
  67b4072c_3549_0182_2962_827546c9b302["diffHydratedStyles()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| 67b4072c_3549_0182_2962_827546c9b302
  84fbfa5b_7810_e48d_c923_a57422c72f70["hydrateSrcObjectAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| 84fbfa5b_7810_e48d_c923_a57422c72f70
  d26613be_511f_ca92_6515_bce3e82633a6["hydrateSanitizedAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| d26613be_511f_ca92_6515_bce3e82633a6
  e88b4fe5_6838_d36b_0e11_fd1a074c3de7["hydrateBooleanishAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| e88b4fe5_6838_d36b_0e11_fd1a074c3de7
  f3d3e586_5458_0eba_fd59_49b6a40ff86b["hydrateBooleanAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| f3d3e586_5458_0eba_fd59_49b6a40ff86b
  d9024aba_cdc3_95d5_6a11_fa53b54d0173["hydrateOverloadedBooleanAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| d9024aba_cdc3_95d5_6a11_fa53b54d0173
  c3dded8f_7b38_376f_3039_0572dd0804b9["hydratePositiveNumericAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| c3dded8f_7b38_376f_3039_0572dd0804b9
  3d159227_9c72_8676_0535_57810df5eb7f["hydrateNumericAttribute()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| 3d159227_9c72_8676_0535_57810df5eb7f
  style 409bfd4f_a0a2_7b82_31de_9321ab006da0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 2569–3101

function diffHydratedGenericElement(
  domElement: Element,
  tag: string,
  props: Object,
  hostContext: HostContext,
  extraAttributes: Set<string>,
  serverDifferences: {[propName: string]: mixed},
) {
  for (const propKey in props) {
    if (!props.hasOwnProperty(propKey)) {
      continue;
    }
    const value = props[propKey];
    if (value == null) {
      continue;
    }
    if (registrationNameDependencies.hasOwnProperty(propKey)) {
      if (typeof value !== 'function') {
        warnForInvalidEventListener(propKey, value);
      }
      continue;
    }
    if (props.suppressHydrationWarning === true) {
      // Don't bother comparing. We're ignoring all these warnings.
      continue;
    }
    // Validate that the properties correspond to their expected values.
    switch (propKey) {
      case 'children': {
        if (typeof value === 'string' || typeof value === 'number') {
          warnForPropDifference(
            'children',
            domElement.textContent,
            value,
            serverDifferences,
          );
        }
        continue;
      }
      // Checked above already
      case 'suppressContentEditableWarning':
      case 'suppressHydrationWarning':
      case 'value': // Controlled attributes are not validated
      case 'checked': // TODO: Only ignore them on controlled tags.
      case 'selected':
      case 'defaultValue':
      case 'defaultChecked':
      case 'innerHTML':
      case 'ref':
        // Noop
        continue;
      case 'dangerouslySetInnerHTML':
        const serverHTML = domElement.innerHTML;
        const nextHtml = value ? value.__html : undefined;
        if (nextHtml != null) {
          const expectedHTML = normalizeHTML(domElement, nextHtml);
          if (serverHTML !== expectedHTML) {
            serverDifferences[propKey] = {
              __html: serverHTML,
            };
          }
        }
        continue;
      case 'className':
        hydrateAttribute(
          domElement,
          propKey,
          'class',
          value,
          extraAttributes,
          serverDifferences,
        );
        continue;
      case 'tabIndex':
        hydrateAttribute(
          domElement,
          propKey,
          'tabindex',
          value,
          extraAttributes,
          serverDifferences,

Domain

Subdomains

Frequently Asked Questions

What does diffHydratedGenericElement() do?
diffHydratedGenericElement() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is diffHydratedGenericElement() defined?
diffHydratedGenericElement() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 2569.
What does diffHydratedGenericElement() call?
diffHydratedGenericElement() calls 14 function(s): diffHydratedStyles, getPossibleStandardName, getValueForAttribute, hydrateAttribute, hydrateBooleanAttribute, hydrateBooleanishAttribute, hydrateNumericAttribute, hydrateOverloadedBooleanAttribute, and 6 more.
What calls diffHydratedGenericElement()?
diffHydratedGenericElement() is called by 1 function(s): diffHydratedProperties.

Analyze Your Own Codebase

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

Try Supermodel Free