MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / mountClassInstance

Function mountClassInstance

code/controlled-uncontrolled/public/app.js:7839–7880  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

7837
7838 // Invokes the mount life-cycles on a previously never rendered instance.
7839 function mountClassInstance(workInProgress, renderExpirationTime) {
7840 var ctor = workInProgress.type;
7841 var current = workInProgress.alternate;
7842
7843 {
7844 checkClassInstance(workInProgress);
7845 }
7846
7847 var instance = workInProgress.stateNode;
7848 var props = workInProgress.pendingProps;
7849 var unmaskedContext = getUnmaskedContext(workInProgress);
7850
7851 instance.props = props;
7852 instance.state = workInProgress.memoizedState;
7853 instance.refs = emptyObject;
7854 instance.context = getMaskedContext(workInProgress, unmaskedContext);
7855
7856 {
7857 if (workInProgress.mode & StrictMode) {
7858 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
7859 }
7860
7861 if (warnAboutDeprecatedLifecycles) {
7862 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
7863 }
7864 }
7865
7866 // In order to support react-lifecycles-compat polyfilled components,
7867 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
7868 if ((typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
7869 callComponentWillMount(workInProgress, instance);
7870 // If we had additional state updates during this life-cycle, let's
7871 // process them now.
7872 var updateQueue = workInProgress.updateQueue;
7873 if (updateQueue !== null) {
7874 instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
7875 }
7876 }
7877 if (typeof instance.componentDidMount === 'function') {
7878 workInProgress.effectTag |= Update;
7879 }
7880 }
7881
7882 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
7883 var ctor = workInProgress.type;

Callers 2

updateClassComponentFunction · 0.70

Calls 5

checkClassInstanceFunction · 0.70
getUnmaskedContextFunction · 0.70
getMaskedContextFunction · 0.70
callComponentWillMountFunction · 0.70
processUpdateQueueFunction · 0.70

Tested by

no test coverage detected