commitClassLayoutLifecycles() — react Function Reference
Architecture documentation for the commitClassLayoutLifecycles() function in ReactFiberCommitEffects.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89["commitClassLayoutLifecycles()"] 8f5342bb_933e_6410_b584_cc120047394a["ReactFiberCommitEffects.js"] e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89 -->|defined in| 8f5342bb_933e_6410_b584_cc120047394a ce61aa22_42d2_811a_b317_96c8d0cb0321["commitLayoutEffectOnFiber()"] ce61aa22_42d2_811a_b317_96c8d0cb0321 -->|calls| e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89 c4d9a9cc_f5a1_3cd7_8ada_0c662e173d45["shouldProfile()"] e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89 -->|calls| c4d9a9cc_f5a1_3cd7_8ada_0c662e173d45 7f5a1eb6_175b_de57_e39a_6c9d67383c84["resolveClassComponentProps()"] e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89 -->|calls| 7f5a1eb6_175b_de57_e39a_6c9d67383c84 style e2aa7e1c_c4bf_b49f_2759_ec6a5e7b2f89 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberCommitEffects.js lines 339–494
export function commitClassLayoutLifecycles(
finishedWork: Fiber,
current: Fiber | null,
) {
const instance = finishedWork.stateNode;
if (current === null) {
// We could update instance props and state here,
// but instead we rely on them being set during last render.
// TODO: revisit this when we implement resuming.
if (__DEV__) {
if (
!finishedWork.type.defaultProps &&
!('ref' in finishedWork.memoizedProps) &&
!didWarnAboutReassigningProps
) {
if (instance.props !== finishedWork.memoizedProps) {
console.error(
'Expected %s props to match memoized props before ' +
'componentDidMount. ' +
'This might either be because of a bug in React, or because ' +
'a component reassigns its own `this.props`. ' +
'Please file an issue.',
getComponentNameFromFiber(finishedWork) || 'instance',
);
}
if (instance.state !== finishedWork.memoizedState) {
console.error(
'Expected %s state to match memoized state before ' +
'componentDidMount. ' +
'This might either be because of a bug in React, or because ' +
'a component reassigns its own `this.state`. ' +
'Please file an issue.',
getComponentNameFromFiber(finishedWork) || 'instance',
);
}
}
}
if (shouldProfile(finishedWork)) {
startEffectTimer();
if (__DEV__) {
runWithFiberInDEV(
finishedWork,
callComponentDidMountInDEV,
finishedWork,
instance,
);
} else {
try {
instance.componentDidMount();
} catch (error) {
captureCommitPhaseError(finishedWork, finishedWork.return, error);
}
}
recordEffectDuration(finishedWork);
} else {
if (__DEV__) {
runWithFiberInDEV(
finishedWork,
callComponentDidMountInDEV,
finishedWork,
instance,
);
} else {
try {
instance.componentDidMount();
} catch (error) {
captureCommitPhaseError(finishedWork, finishedWork.return, error);
}
}
}
} else {
const prevProps = resolveClassComponentProps(
finishedWork.type,
current.memoizedProps,
);
const prevState = current.memoizedState;
// We could update instance props and state here,
// but instead we rely on them being set during last render.
// TODO: revisit this when we implement resuming.
if (__DEV__) {
if (
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does commitClassLayoutLifecycles() do?
commitClassLayoutLifecycles() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitEffects.js.
Where is commitClassLayoutLifecycles() defined?
commitClassLayoutLifecycles() is defined in packages/react-reconciler/src/ReactFiberCommitEffects.js at line 339.
What does commitClassLayoutLifecycles() call?
commitClassLayoutLifecycles() calls 2 function(s): resolveClassComponentProps, shouldProfile.
What calls commitClassLayoutLifecycles()?
commitClassLayoutLifecycles() is called by 1 function(s): commitLayoutEffectOnFiber.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free