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

Function mountClassInstance

code/styling/public/app.js:8515–8556  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

8513
8514 // Invokes the mount life-cycles on a previously never rendered instance.
8515 function mountClassInstance(workInProgress, renderExpirationTime) {
8516 var ctor = workInProgress.type;
8517 var current = workInProgress.alternate;
8518
8519 {
8520 checkClassInstance(workInProgress);
8521 }
8522
8523 var instance = workInProgress.stateNode;
8524 var props = workInProgress.pendingProps;
8525 var unmaskedContext = getUnmaskedContext(workInProgress);
8526
8527 instance.props = props;
8528 instance.state = workInProgress.memoizedState;
8529 instance.refs = emptyObject;
8530 instance.context = getMaskedContext(workInProgress, unmaskedContext);
8531
8532 {
8533 if (workInProgress.mode & StrictMode) {
8534 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
8535 }
8536
8537 if (warnAboutDeprecatedLifecycles) {
8538 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
8539 }
8540 }
8541
8542 // In order to support react-lifecycles-compat polyfilled components,
8543 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
8544 if ((typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
8545 callComponentWillMount(workInProgress, instance);
8546 // If we had additional state updates during this life-cycle, let's
8547 // process them now.
8548 var updateQueue = workInProgress.updateQueue;
8549 if (updateQueue !== null) {
8550 instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
8551 }
8552 }
8553 if (typeof instance.componentDidMount === 'function') {
8554 workInProgress.effectTag |= Update;
8555 }
8556 }
8557
8558 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
8559 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