validateOptionProps() — react Function Reference
Architecture documentation for the validateOptionProps() function in ReactDOMOption.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 2d1887fd_1055_7a9f_f81b_d9416d83bdab["validateOptionProps()"] b65ed748_8e6c_776b_1a5a_46949ac08a42["ReactDOMOption.js"] 2d1887fd_1055_7a9f_f81b_d9416d83bdab -->|defined in| b65ed748_8e6c_776b_1a5a_46949ac08a42 96cf114b_9b89_b174_432c_1584a973fcdd["setInitialProperties()"] 96cf114b_9b89_b174_432c_1584a973fcdd -->|calls| 2d1887fd_1055_7a9f_f81b_d9416d83bdab 894d4888_e1c9_cdd6_e0cb_7451b6fba151["hydrateProperties()"] 894d4888_e1c9_cdd6_e0cb_7451b6fba151 -->|calls| 2d1887fd_1055_7a9f_f81b_d9416d83bdab style 2d1887fd_1055_7a9f_f81b_d9416d83bdab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/ReactDOMOption.js lines 20–64
export function validateOptionProps(element: Element, props: Object) {
if (__DEV__) {
// If a value is not provided, then the children must be simple.
if (props.value == null) {
if (typeof props.children === 'object' && props.children !== null) {
Children.forEach(props.children, function (child) {
if (child == null) {
return;
}
if (
typeof child === 'string' ||
typeof child === 'number' ||
typeof child === 'bigint'
) {
return;
}
if (!didWarnInvalidChild) {
didWarnInvalidChild = true;
console.error(
'Cannot infer the option value of complex children. ' +
'Pass a `value` prop or use a plain string as children to <option>.',
);
}
});
} else if (props.dangerouslySetInnerHTML != null) {
if (!didWarnInvalidInnerHTML) {
didWarnInvalidInnerHTML = true;
console.error(
'Pass a `value` prop if you set dangerouslyInnerHTML so React knows ' +
'which value should be selected.',
);
}
}
}
// TODO: Remove support for `selected` in <option>.
if (props.selected != null && !didWarnSelectedSetOnOption) {
console.error(
'Use the `defaultValue` or `value` props on <select> instead of ' +
'setting `selected` on <option>.',
);
didWarnSelectedSetOnOption = true;
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does validateOptionProps() do?
validateOptionProps() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMOption.js.
Where is validateOptionProps() defined?
validateOptionProps() is defined in packages/react-dom-bindings/src/client/ReactDOMOption.js at line 20.
What calls validateOptionProps()?
validateOptionProps() is called by 2 function(s): hydrateProperties, setInitialProperties.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free