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

Function mountClassInstance

code/higher-order-components/public/app.js:8509–8550  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

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