setValueForPropertyOnCustomComponent() — react Function Reference
Architecture documentation for the setValueForPropertyOnCustomComponent() function in DOMPropertyOperations.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d["setValueForPropertyOnCustomComponent()"] 390123a6_56c3_29ed_a331_44deb86078d6["DOMPropertyOperations.js"] 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d -->|defined in| 390123a6_56c3_29ed_a331_44deb86078d6 65717281_efda_4b8d_7a97_9947c26aa05e["setPropOnCustomElement()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d b75892dd_dacd_d978_2b97_090839521b0e["setValueForAttribute()"] 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d -->|calls| b75892dd_dacd_d978_2b97_090839521b0e style 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/DOMPropertyOperations.js lines 190–235
export function setValueForPropertyOnCustomComponent(
node: Element,
name: string,
value: mixed,
) {
if (name[0] === 'o' && name[1] === 'n') {
const useCapture = name.endsWith('Capture');
const eventName = name.slice(2, useCapture ? name.length - 7 : undefined);
const prevProps = getFiberCurrentPropsFromNode(node);
// $FlowFixMe[invalid-computed-prop]
const prevValue = prevProps != null ? prevProps[name] : null;
if (typeof prevValue === 'function') {
node.removeEventListener(eventName, prevValue, useCapture);
}
if (typeof value === 'function') {
if (typeof prevValue !== 'function' && prevValue !== null) {
// If we previously assigned a non-function type into this node, then
// remove it when switching to event listener mode.
if (name in (node: any)) {
(node: any)[name] = null;
} else if (node.hasAttribute(name)) {
node.removeAttribute(name);
}
}
// $FlowFixMe[incompatible-cast] value can't be casted to EventListener.
node.addEventListener(eventName, (value: EventListener), useCapture);
return;
}
}
trackHostMutation();
if (name in (node: any)) {
(node: any)[name] = value;
return;
}
if (value === true) {
node.setAttribute(name, '');
return;
}
// From here, it's the same as any attribute
setValueForAttribute(node, name, value);
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does setValueForPropertyOnCustomComponent() do?
setValueForPropertyOnCustomComponent() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/DOMPropertyOperations.js.
Where is setValueForPropertyOnCustomComponent() defined?
setValueForPropertyOnCustomComponent() is defined in packages/react-dom-bindings/src/client/DOMPropertyOperations.js at line 190.
What does setValueForPropertyOnCustomComponent() call?
setValueForPropertyOnCustomComponent() calls 1 function(s): setValueForAttribute.
What calls setValueForPropertyOnCustomComponent()?
setValueForPropertyOnCustomComponent() is called by 1 function(s): setPropOnCustomElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free