Home / Function/ hydratePositiveNumericAttribute() — react Function Reference

hydratePositiveNumericAttribute() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c3dded8f_7b38_376f_3039_0572dd0804b9["hydratePositiveNumericAttribute()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  c3dded8f_7b38_376f_3039_0572dd0804b9 -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  409bfd4f_a0a2_7b82_31de_9321ab006da0["diffHydratedGenericElement()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| c3dded8f_7b38_376f_3039_0572dd0804b9
  befb3c8a_925e_b969_cf38_442509b5162d["warnForPropDifference()"]
  c3dded8f_7b38_376f_3039_0572dd0804b9 -->|calls| befb3c8a_925e_b969_cf38_442509b5162d
  style c3dded8f_7b38_376f_3039_0572dd0804b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 2309–2358

function hydratePositiveNumericAttribute(
  domElement: Element,
  propKey: string,
  attributeName: string,
  value: any,
  extraAttributes: Set<string>,
  serverDifferences: {[propName: string]: mixed},
): void {
  extraAttributes.delete(attributeName);
  const serverValue = domElement.getAttribute(attributeName);
  if (serverValue === null) {
    switch (typeof value) {
      case 'undefined':
      case 'function':
      case 'symbol':
      case 'boolean':
        return;
      default:
        if (isNaN(value) || value < 1) {
          return;
        }
    }
  } else {
    if (value == null) {
      // We had an attribute but shouldn't have had one, so read it
      // for the error message.
    } else {
      switch (typeof value) {
        case 'function':
        case 'symbol':
        case 'boolean':
          break;
        default: {
          if (isNaN(value) || value < 1) {
            // We had an attribute but shouldn't have had one, so read it
            // for the error message.
            break;
          }
          if (__DEV__) {
            checkAttributeStringCoercion(value, propKey);
          }
          if (serverValue === '' + value) {
            return;
          }
        }
      }
    }
  }
  warnForPropDifference(propKey, serverValue, value, serverDifferences);
}

Domain

Subdomains

Frequently Asked Questions

What does hydratePositiveNumericAttribute() do?
hydratePositiveNumericAttribute() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is hydratePositiveNumericAttribute() defined?
hydratePositiveNumericAttribute() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 2309.
What does hydratePositiveNumericAttribute() call?
hydratePositiveNumericAttribute() calls 1 function(s): warnForPropDifference.
What calls hydratePositiveNumericAttribute()?
hydratePositiveNumericAttribute() is called by 1 function(s): diffHydratedGenericElement.

Analyze Your Own Codebase

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

Try Supermodel Free