setPropOnCustomElement() — react Function Reference
Architecture documentation for the setPropOnCustomElement() function in ReactDOMComponent.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 65717281_efda_4b8d_7a97_9947c26aa05e["setPropOnCustomElement()"] 1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b 96cf114b_9b89_b174_432c_1584a973fcdd["setInitialProperties()"] 96cf114b_9b89_b174_432c_1584a973fcdd -->|calls| 65717281_efda_4b8d_7a97_9947c26aa05e 336b5c16_66c9_7089_05c5_2ec95eb7ed11["updateProperties()"] 336b5c16_66c9_7089_05c5_2ec95eb7ed11 -->|calls| 65717281_efda_4b8d_7a97_9947c26aa05e 236c422d_d866_d548_e097_3cec99530791["setValueForStyles()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| 236c422d_d866_d548_e097_3cec99530791 05a2c649_61ae_abc9_51e9_4bae6eb065ff["setTextContent()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| 05a2c649_61ae_abc9_51e9_4bae6eb065ff b98b4c7e_a5fc_744a_2478_0278e64cf8e0["warnForInvalidEventListener()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| b98b4c7e_a5fc_744a_2478_0278e64cf8e0 9a006a44_c580_470b_507b_17fea64729bd["listenToNonDelegatedEvent()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| 9a006a44_c580_470b_507b_17fea64729bd a0421d9a_64b7_2b13_1226_e3a3b9292e4e["trapClickOnNonInteractiveElement()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| a0421d9a_64b7_2b13_1226_e3a3b9292e4e 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d["setValueForPropertyOnCustomComponent()"] 65717281_efda_4b8d_7a97_9947c26aa05e -->|calls| 7ef9c2ac_b7a6_04bb_4dac_940bd3dcfe7d style 65717281_efda_4b8d_7a97_9947c26aa05e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 984–1087
function setPropOnCustomElement(
domElement: Element,
tag: string,
key: string,
value: mixed,
props: any,
prevValue: mixed,
): void {
switch (key) {
case 'style': {
setValueForStyles(domElement, value, prevValue);
return;
}
case 'dangerouslySetInnerHTML': {
if (value != null) {
if (typeof value !== 'object' || !('__html' in value)) {
throw new Error(
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
'Please visit https://react.dev/link/dangerously-set-inner-html ' +
'for more information.',
);
}
const nextHtml: any = value.__html;
if (nextHtml != null) {
if (props.children != null) {
throw new Error(
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.',
);
}
domElement.innerHTML = nextHtml;
}
}
break;
}
case 'children': {
if (typeof value === 'string') {
setTextContent(domElement, value);
} else if (typeof value === 'number' || typeof value === 'bigint') {
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
setTextContent(domElement, '' + value);
} else {
return;
}
break;
}
case 'onScroll': {
if (value != null) {
if (__DEV__ && typeof value !== 'function') {
warnForInvalidEventListener(key, value);
}
listenToNonDelegatedEvent('scroll', domElement);
}
return;
}
case 'onScrollEnd': {
if (value != null) {
if (__DEV__ && typeof value !== 'function') {
warnForInvalidEventListener(key, value);
}
listenToNonDelegatedEvent('scrollend', domElement);
if (enableScrollEndPolyfill) {
// For use by the polyfill.
listenToNonDelegatedEvent('scroll', domElement);
}
}
return;
}
case 'onClick': {
// TODO: This cast may not be sound for SVG, MathML or custom elements.
if (value != null) {
if (__DEV__ && typeof value !== 'function') {
warnForInvalidEventListener(key, value);
}
trapClickOnNonInteractiveElement(((domElement: any): HTMLElement));
}
return;
}
case 'suppressContentEditableWarning':
case 'suppressHydrationWarning':
case 'innerHTML':
case 'ref': {
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does setPropOnCustomElement() do?
setPropOnCustomElement() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is setPropOnCustomElement() defined?
setPropOnCustomElement() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 984.
What does setPropOnCustomElement() call?
setPropOnCustomElement() calls 6 function(s): listenToNonDelegatedEvent, setTextContent, setValueForPropertyOnCustomComponent, setValueForStyles, trapClickOnNonInteractiveElement, warnForInvalidEventListener.
What calls setPropOnCustomElement()?
setPropOnCustomElement() is called by 2 function(s): setInitialProperties, updateProperties.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free