diffHydratedProperties() — react Function Reference
Architecture documentation for the diffHydratedProperties() function in ReactDOMComponent.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3246fe42_26b8_0630_2d76_6dda95625fe3["diffHydratedProperties()"] 1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"] 3246fe42_26b8_0630_2d76_6dda95625fe3 -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b 2085de17_2522_af25_8b8d_76ff7166552c["isCustomElement()"] 3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| 2085de17_2522_af25_8b8d_76ff7166552c b3ccac7d_1304_9653_2f32_5c5e2bbc637e["diffHydratedCustomComponent()"] 3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| b3ccac7d_1304_9653_2f32_5c5e2bbc637e 409bfd4f_a0a2_7b82_31de_9321ab006da0["diffHydratedGenericElement()"] 3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| 409bfd4f_a0a2_7b82_31de_9321ab006da0 255bc5ba_4119_c519_1a8a_dd9223b03b3e["warnForExtraAttributes()"] 3246fe42_26b8_0630_2d76_6dda95625fe3 -->|calls| 255bc5ba_4119_c519_1a8a_dd9223b03b3e style 3246fe42_26b8_0630_2d76_6dda95625fe3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 3265–3331
export function diffHydratedProperties(
domElement: Element,
tag: string,
props: Object,
hostContext: HostContext,
): null | Object {
const serverDifferences: {[propName: string]: mixed} = {};
if (__DEV__) {
const extraAttributes: Set<string> = new Set();
const attributes = domElement.attributes;
for (let i = 0; i < attributes.length; i++) {
const name = attributes[i].name.toLowerCase();
switch (name) {
// Controlled attributes are not validated
// TODO: Only ignore them on controlled tags.
case 'value':
break;
case 'checked':
break;
case 'selected':
break;
case 'vt-name':
case 'vt-update':
case 'vt-enter':
case 'vt-exit':
case 'vt-share':
if (enableViewTransition) {
// View Transition annotations are expected from the Server Runtime.
// However, if they're also specified on the client and don't match
// that's an error.
break;
}
// Fallthrough
default:
// Intentionally use the original name.
// See discussion in https://github.com/facebook/react/pull/10676.
extraAttributes.add(attributes[i].name);
}
}
if (isCustomElement(tag, props)) {
diffHydratedCustomComponent(
domElement,
tag,
props,
hostContext,
extraAttributes,
serverDifferences,
);
} else {
diffHydratedGenericElement(
domElement,
tag,
props,
hostContext,
extraAttributes,
serverDifferences,
);
}
if (extraAttributes.size > 0 && props.suppressHydrationWarning !== true) {
warnForExtraAttributes(domElement, extraAttributes, serverDifferences);
}
}
if (Object.keys(serverDifferences).length === 0) {
return null;
}
return serverDifferences;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does diffHydratedProperties() do?
diffHydratedProperties() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is diffHydratedProperties() defined?
diffHydratedProperties() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 3265.
What does diffHydratedProperties() call?
diffHydratedProperties() calls 4 function(s): diffHydratedCustomComponent, diffHydratedGenericElement, isCustomElement, warnForExtraAttributes.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free