callComponentWillMount() — react Function Reference
Architecture documentation for the callComponentWillMount() function in ReactFizzClassComponent.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3867b5d4_e231_02e6_8a86_90d620156f07["callComponentWillMount()"] 8f850c79_0562_f37f_80ff_563c50cd0996["ReactFizzClassComponent.js"] 3867b5d4_e231_02e6_8a86_90d620156f07 -->|defined in| 8f850c79_0562_f37f_80ff_563c50cd0996 214e29b1_8411_c0df_65fc_dabe157ff86e["mountClassInstance()"] 214e29b1_8411_c0df_65fc_dabe157ff86e -->|calls| 3867b5d4_e231_02e6_8a86_90d620156f07 style 3867b5d4_e231_02e6_8a86_90d620156f07 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-server/src/ReactFizzClassComponent.js lines 544–584
function callComponentWillMount(type: any, instance: any) {
const oldState = instance.state;
if (typeof instance.componentWillMount === 'function') {
if (__DEV__) {
if (instance.componentWillMount.__suppressDeprecationWarning !== true) {
const componentName = getComponentNameFromType(type) || 'Unknown';
if (!didWarnAboutDeprecatedWillMount[componentName]) {
console.warn(
// keep this warning in sync with ReactStrictModeWarning.js
'componentWillMount has been renamed, and is not recommended for use. ' +
'See https://react.dev/link/unsafe-component-lifecycles for details.\n\n' +
'* Move code from componentWillMount to componentDidMount (preferred in most cases) ' +
'or the constructor.\n' +
'\nPlease update the following components: %s',
componentName,
);
didWarnAboutDeprecatedWillMount[componentName] = true;
}
}
}
instance.componentWillMount();
}
if (typeof instance.UNSAFE_componentWillMount === 'function') {
instance.UNSAFE_componentWillMount();
}
if (oldState !== instance.state) {
if (__DEV__) {
console.error(
'%s.componentWillMount(): Assigning directly to this.state is ' +
"deprecated (except inside a component's " +
'constructor). Use setState instead.',
getComponentNameFromType(type) || 'Component',
);
}
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does callComponentWillMount() do?
callComponentWillMount() is a function in the react codebase, defined in packages/react-server/src/ReactFizzClassComponent.js.
Where is callComponentWillMount() defined?
callComponentWillMount() is defined in packages/react-server/src/ReactFizzClassComponent.js at line 544.
What calls callComponentWillMount()?
callComponentWillMount() is called by 1 function(s): mountClassInstance.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free