Home / Function/ callComponentWillMount() — react Function Reference

callComponentWillMount() — react Function Reference

Architecture documentation for the callComponentWillMount() function in ReactFiberClassComponent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9d2b4de0_7d00_8afe_d25a_63046c5f7d5d["callComponentWillMount()"]
  3805476a_1924_0e35_fff7_6afad197a523["ReactFiberClassComponent.js"]
  9d2b4de0_7d00_8afe_d25a_63046c5f7d5d -->|defined in| 3805476a_1924_0e35_fff7_6afad197a523
  3d21bb44_e12a_666f_ff91_4155c0f8d71b["mountClassInstance()"]
  3d21bb44_e12a_666f_ff91_4155c0f8d71b -->|calls| 9d2b4de0_7d00_8afe_d25a_63046c5f7d5d
  style 9d2b4de0_7d00_8afe_d25a_63046c5f7d5d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberClassComponent.js lines 705–726

function callComponentWillMount(workInProgress: Fiber, instance: any) {
  const oldState = instance.state;

  if (typeof instance.componentWillMount === 'function') {
    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.',
        getComponentNameFromFiber(workInProgress) || 'Component',
      );
    }
    classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does callComponentWillMount() do?
callComponentWillMount() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberClassComponent.js.
Where is callComponentWillMount() defined?
callComponentWillMount() is defined in packages/react-reconciler/src/ReactFiberClassComponent.js at line 705.
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