ReactControlledValuePropTypes.js — react Source File
Architecture documentation for ReactControlledValuePropTypes.js, a javascript file in the react codebase. 0 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 610351e4_d33b_fa99_6ef7_a03d24afd5a4["ReactControlledValuePropTypes.js"] 1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"] 1e990658_7cea_75be_1f24_2399bdf9f15b --> 610351e4_d33b_fa99_6ef7_a03d24afd5a4 4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"] 4ae326e8_2c2e_2843_d5a5_16edbddd103a --> 610351e4_d33b_fa99_6ef7_a03d24afd5a4 style 610351e4_d33b_fa99_6ef7_a03d24afd5a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
*/
const hasReadOnlyValue = {
button: true,
checkbox: true,
image: true,
hidden: true,
radio: true,
reset: true,
submit: true,
};
export function checkControlledValueProps(
tagName: string,
props: Object,
): void {
if (__DEV__) {
if (
!(
hasReadOnlyValue[props.type] ||
props.onChange ||
props.onInput ||
props.readOnly ||
props.disabled ||
props.value == null
)
) {
if (tagName === 'select') {
console.error(
'You provided a `value` prop to a form field without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultValue`. Otherwise, set `onChange`.',
);
} else {
console.error(
'You provided a `value` prop to a form field without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.',
);
}
}
if (
!(
props.onChange ||
props.readOnly ||
props.disabled ||
props.checked == null
)
) {
console.error(
'You provided a `checked` prop to a form field without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultChecked`. Otherwise, ' +
'set either `onChange` or `readOnly`.',
);
}
}
}
Domain
Subdomains
Functions
Imported By
Source
Frequently Asked Questions
What does ReactControlledValuePropTypes.js do?
ReactControlledValuePropTypes.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactControlledValuePropTypes.js?
ReactControlledValuePropTypes.js defines 1 function(s): checkControlledValueProps.
What files import ReactControlledValuePropTypes.js?
ReactControlledValuePropTypes.js is imported by 2 file(s): ReactDOMComponent.js, ReactFizzConfigDOM.js.
Where is ReactControlledValuePropTypes.js in the architecture?
ReactControlledValuePropTypes.js is located at packages/react-dom-bindings/src/shared/ReactControlledValuePropTypes.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free