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

Function mountClassInstance

code/communication/public/app.js:8550–8591  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

8548
8549 // Invokes the mount life-cycles on a previously never rendered instance.
8550 function mountClassInstance(workInProgress, renderExpirationTime) {
8551 var ctor = workInProgress.type;
8552 var current = workInProgress.alternate;
8553
8554 {
8555 checkClassInstance(workInProgress);
8556 }
8557
8558 var instance = workInProgress.stateNode;
8559 var props = workInProgress.pendingProps;
8560 var unmaskedContext = getUnmaskedContext(workInProgress);
8561
8562 instance.props = props;
8563 instance.state = workInProgress.memoizedState;
8564 instance.refs = emptyObject;
8565 instance.context = getMaskedContext(workInProgress, unmaskedContext);
8566
8567 {
8568 if (workInProgress.mode & StrictMode) {
8569 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
8570 }
8571
8572 if (warnAboutDeprecatedLifecycles) {
8573 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
8574 }
8575 }
8576
8577 // In order to support react-lifecycles-compat polyfilled components,
8578 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
8579 if ((typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
8580 callComponentWillMount(workInProgress, instance);
8581 // If we had additional state updates during this life-cycle, let's
8582 // process them now.
8583 var updateQueue = workInProgress.updateQueue;
8584 if (updateQueue !== null) {
8585 instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
8586 }
8587 }
8588 if (typeof instance.componentDidMount === 'function') {
8589 workInProgress.effectTag |= Update;
8590 }
8591 }
8592
8593 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
8594 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