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

Function mountClassInstance

code/one-direction-data-flow/public/app.js:8388–8429  ·  view source on GitHub ↗
(workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

8386
8387 // Invokes the mount life-cycles on a previously never rendered instance.
8388 function mountClassInstance(workInProgress, renderExpirationTime) {
8389 var ctor = workInProgress.type;
8390 var current = workInProgress.alternate;
8391
8392 {
8393 checkClassInstance(workInProgress);
8394 }
8395
8396 var instance = workInProgress.stateNode;
8397 var props = workInProgress.pendingProps;
8398 var unmaskedContext = getUnmaskedContext(workInProgress);
8399
8400 instance.props = props;
8401 instance.state = workInProgress.memoizedState;
8402 instance.refs = emptyObject;
8403 instance.context = getMaskedContext(workInProgress, unmaskedContext);
8404
8405 {
8406 if (workInProgress.mode & StrictMode) {
8407 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
8408 }
8409
8410 if (warnAboutDeprecatedLifecycles) {
8411 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
8412 }
8413 }
8414
8415 // In order to support react-lifecycles-compat polyfilled components,
8416 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
8417 if ((typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') {
8418 callComponentWillMount(workInProgress, instance);
8419 // If we had additional state updates during this life-cycle, let's
8420 // process them now.
8421 var updateQueue = workInProgress.updateQueue;
8422 if (updateQueue !== null) {
8423 instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
8424 }
8425 }
8426 if (typeof instance.componentDidMount === 'function') {
8427 workInProgress.effectTag |= Update;
8428 }
8429 }
8430
8431 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
8432 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