Home / Function/ resumeMountClassInstance() — react Function Reference

resumeMountClassInstance() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  40e9392c_b382_4ef8_9ede_8ac85559673c["resumeMountClassInstance()"]
  3805476a_1924_0e35_fff7_6afad197a523["ReactFiberClassComponent.js"]
  40e9392c_b382_4ef8_9ede_8ac85559673c -->|defined in| 3805476a_1924_0e35_fff7_6afad197a523
  9bea19b8_e307_63f1_e3b4_89c20a3fd20b["updateClassComponent()"]
  9bea19b8_e307_63f1_e3b4_89c20a3fd20b -->|calls| 40e9392c_b382_4ef8_9ede_8ac85559673c
  7f5a1eb6_175b_de57_e39a_6c9d67383c84["resolveClassComponentProps()"]
  40e9392c_b382_4ef8_9ede_8ac85559673c -->|calls| 7f5a1eb6_175b_de57_e39a_6c9d67383c84
  d83968be_2eaf_cd1b_857b_b74b96d7a349["callComponentWillReceiveProps()"]
  40e9392c_b382_4ef8_9ede_8ac85559673c -->|calls| d83968be_2eaf_cd1b_857b_b74b96d7a349
  9f4500d1_a30b_b3dc_2405_2ab2117c51e4["applyDerivedStateFromProps()"]
  40e9392c_b382_4ef8_9ede_8ac85559673c -->|calls| 9f4500d1_a30b_b3dc_2405_2ab2117c51e4
  2b0ae04e_0543_188d_43fc_818335c01e4c["checkShouldComponentUpdate()"]
  40e9392c_b382_4ef8_9ede_8ac85559673c -->|calls| 2b0ae04e_0543_188d_43fc_818335c01e4c
  style 40e9392c_b382_4ef8_9ede_8ac85559673c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberClassComponent.js lines 852–1001

function resumeMountClassInstance(
  workInProgress: Fiber,
  ctor: any,
  newProps: any,
  renderLanes: Lanes,
): boolean {
  const instance = workInProgress.stateNode;

  const unresolvedOldProps = workInProgress.memoizedProps;
  const oldProps = resolveClassComponentProps(ctor, unresolvedOldProps);
  instance.props = oldProps;

  const oldContext = instance.context;
  const contextType = ctor.contextType;
  let nextContext = emptyContextObject;
  if (typeof contextType === 'object' && contextType !== null) {
    nextContext = readContext(contextType);
  } else if (!disableLegacyContext) {
    const nextLegacyUnmaskedContext = getUnmaskedContext(
      workInProgress,
      ctor,
      true,
    );
    nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
  }

  const getDerivedStateFromProps = ctor.getDerivedStateFromProps;
  const hasNewLifecycles =
    typeof getDerivedStateFromProps === 'function' ||
    typeof instance.getSnapshotBeforeUpdate === 'function';

  // When comparing whether props changed, we should compare using the
  // unresolved props object that is stored on the fiber, rather than the
  // one that gets assigned to the instance, because that object may have been
  // cloned to resolve default props and/or remove `ref`.
  const unresolvedNewProps = workInProgress.pendingProps;
  const didReceiveNewProps = unresolvedNewProps !== unresolvedOldProps;

  // Note: During these life-cycles, instance.props/instance.state are what
  // ever the previously attempted to render - not the "current". However,
  // during componentDidUpdate we pass the "current" props.

  // In order to support react-lifecycles-compat polyfilled components,
  // Unsafe lifecycles should not be invoked for components using the new APIs.
  if (
    !hasNewLifecycles &&
    (typeof instance.UNSAFE_componentWillReceiveProps === 'function' ||
      typeof instance.componentWillReceiveProps === 'function')
  ) {
    if (didReceiveNewProps || oldContext !== nextContext) {
      callComponentWillReceiveProps(
        workInProgress,
        instance,
        newProps,
        nextContext,
      );
    }
  }

  resetHasForceUpdateBeforeProcessing();

  const oldState = workInProgress.memoizedState;
  let newState = (instance.state = oldState);
  processUpdateQueue(workInProgress, newProps, instance, renderLanes);
  suspendIfUpdateReadFromEntangledAsyncAction();
  newState = workInProgress.memoizedState;
  if (
    !didReceiveNewProps &&
    oldState === newState &&
    !hasContextChanged() &&
    !checkHasForceUpdateAfterProcessing()
  ) {
    // If an update was already in progress, we should schedule an Update
    // effect even though we're bailing out, so that cWU/cDU are called.
    if (typeof instance.componentDidMount === 'function') {
      workInProgress.flags |= Update | LayoutStatic;
    }
    if (__DEV__ && (workInProgress.mode & StrictEffectsMode) !== NoMode) {
      workInProgress.flags |= MountLayoutDev;
    }
    return false;

Domain

Subdomains

Frequently Asked Questions

What does resumeMountClassInstance() do?
resumeMountClassInstance() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberClassComponent.js.
Where is resumeMountClassInstance() defined?
resumeMountClassInstance() is defined in packages/react-reconciler/src/ReactFiberClassComponent.js at line 852.
What does resumeMountClassInstance() call?
resumeMountClassInstance() calls 4 function(s): applyDerivedStateFromProps, callComponentWillReceiveProps, checkShouldComponentUpdate, resolveClassComponentProps.
What calls resumeMountClassInstance()?
resumeMountClassInstance() is called by 1 function(s): updateClassComponent.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free