Home / Function/ updateProperties() — react Function Reference

updateProperties() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  336b5c16_66c9_7089_05c5_2ec95eb7ed11["updateProperties()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  d1920c22_65b3_03a6_5c07_e0adab00dcde["validatePropertiesInDevelopment()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| d1920c22_65b3_03a6_5c07_e0adab00dcde
  5a792874_dbaf_1dd0_9e62_d6a16580e0b5["setProp()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 5a792874_dbaf_1dd0_9e62_d6a16580e0b5
  859b1aa4_1e7b_dfa5_1e21_ba34a1a483ac["updateInput()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 859b1aa4_1e7b_dfa5_1e21_ba34a1a483ac
  3d545c01_fa5f_dc3a_a833_471614f78441["updateSelect()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 3d545c01_fa5f_dc3a_a833_471614f78441
  20ad5b0e_967a_5fe8_89ef_59f98f74759c["updateTextarea()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 20ad5b0e_967a_5fe8_89ef_59f98f74759c
  2085de17_2522_af25_8b8d_76ff7166552c["isCustomElement()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 2085de17_2522_af25_8b8d_76ff7166552c
  65717281_efda_4b8d_7a97_9947c26aa05e["setPropOnCustomElement()"]
  336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 65717281_efda_4b8d_7a97_9947c26aa05e
  style 336b5c16_66c9_7089_05c5_2ec95eb7ed11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 1476–1981

export function updateProperties(
  domElement: Element,
  tag: string,
  lastProps: Object,
  nextProps: Object,
): void {
  if (__DEV__) {
    validatePropertiesInDevelopment(tag, nextProps);
  }

  switch (tag) {
    case 'div':
    case 'span':
    case 'svg':
    case 'path':
    case 'a':
    case 'g':
    case 'p':
    case 'li': {
      // Fast track the most common tag types
      break;
    }
    case 'input': {
      let name = null;
      let type = null;
      let value = null;
      let defaultValue = null;
      let lastDefaultValue = null;
      let checked = null;
      let defaultChecked = null;
      for (const propKey in lastProps) {
        const lastProp = lastProps[propKey];
        if (lastProps.hasOwnProperty(propKey) && lastProp != null) {
          switch (propKey) {
            case 'checked': {
              break;
            }
            case 'value': {
              // This is handled by updateWrapper below.
              break;
            }
            case 'defaultValue': {
              lastDefaultValue = lastProp;
            }
            // defaultChecked and defaultValue are ignored by setProp
            // Fallthrough
            default: {
              if (!nextProps.hasOwnProperty(propKey))
                setProp(domElement, tag, propKey, null, nextProps, lastProp);
            }
          }
        }
      }
      for (const propKey in nextProps) {
        const nextProp = nextProps[propKey];
        const lastProp = lastProps[propKey];
        if (
          nextProps.hasOwnProperty(propKey) &&
          (nextProp != null || lastProp != null)
        ) {
          switch (propKey) {
            case 'type': {
              if (nextProp !== lastProp) {
                trackHostMutation();
              }
              type = nextProp;
              break;
            }
            case 'name': {
              if (nextProp !== lastProp) {
                trackHostMutation();
              }
              name = nextProp;
              break;
            }
            case 'checked': {
              if (nextProp !== lastProp) {
                trackHostMutation();
              }
              checked = nextProp;
              break;

Domain

Subdomains

Frequently Asked Questions

What does updateProperties() do?
updateProperties() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is updateProperties() defined?
updateProperties() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 1476.
What does updateProperties() call?
updateProperties() calls 7 function(s): isCustomElement, setProp, setPropOnCustomElement, updateInput, updateSelect, updateTextarea, validatePropertiesInDevelopment.

Analyze Your Own Codebase

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

Try Supermodel Free