Home / Function/ diffHydratedCustomComponent() — react Function Reference

diffHydratedCustomComponent() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e["diffHydratedCustomComponent()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  3246fe42_26b8_0630_2d76_6dda95625fe3["diffHydratedProperties()"]
  3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| b3ccac7d_1304_9653_2f32_5c5e2bbc637e
  b98b4c7e_a5fc_744a_2478_0278e64cf8e0["warnForInvalidEventListener()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| b98b4c7e_a5fc_744a_2478_0278e64cf8e0
  befb3c8a_925e_b969_cf38_442509b5162d["warnForPropDifference()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| befb3c8a_925e_b969_cf38_442509b5162d
  e6b16ab1_66ce_997c_25dd_60a9670e673b["normalizeHTML()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| e6b16ab1_66ce_997c_25dd_60a9670e673b
  67b4072c_3549_0182_2962_827546c9b302["diffHydratedStyles()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| 67b4072c_3549_0182_2962_827546c9b302
  384f9fa9_8448_66ce_0422_34f51fe0d9cd["getValueForAttributeOnCustomComponent()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| 384f9fa9_8448_66ce_0422_34f51fe0d9cd
  style b3ccac7d_1304_9653_2f32_5c5e2bbc637e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 2436–2560

function diffHydratedCustomComponent(
  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 '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);
          warnForPropDifference(
            propKey,
            serverHTML,
            expectedHTML,
            serverDifferences,
          );
        }
        continue;
      case 'style':
        extraAttributes.delete(propKey);
        diffHydratedStyles(domElement, value, serverDifferences);
        continue;
      case 'offsetParent':
      case 'offsetTop':
      case 'offsetLeft':
      case 'offsetWidth':
      case 'offsetHeight':
      case 'isContentEditable':
      case 'outerText':
      case 'outerHTML':
        extraAttributes.delete(propKey.toLowerCase());
        if (__DEV__) {
          console.error(
            'Assignment to read-only property will result in a no-op: `%s`',
            propKey,
          );
        }
        continue;

Domain

Subdomains

Frequently Asked Questions

What does diffHydratedCustomComponent() do?
diffHydratedCustomComponent() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is diffHydratedCustomComponent() defined?
diffHydratedCustomComponent() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 2436.
What does diffHydratedCustomComponent() call?
diffHydratedCustomComponent() calls 5 function(s): diffHydratedStyles, getValueForAttributeOnCustomComponent, normalizeHTML, warnForInvalidEventListener, warnForPropDifference.
What calls diffHydratedCustomComponent()?
diffHydratedCustomComponent() 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