updateForwardRef() — react Function Reference
Architecture documentation for the updateForwardRef() function in ReactFiberBeginWork.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD f3abfeea_868f_5c8e_9744_74c9973ded12["updateForwardRef()"] 0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c 53f55fda_e2b6_2801_4fbc_525f8828d23d["updateHostRoot()"] 53f55fda_e2b6_2801_4fbc_525f8828d23d -->|calls| f3abfeea_868f_5c8e_9744_74c9973ded12 235e1db1_02a4_912f_7d82_ea6636c850c0["beginWork()"] 235e1db1_02a4_912f_7d82_ea6636c850c0 -->|calls| f3abfeea_868f_5c8e_9744_74c9973ded12 1df0dd5b_17c8_c98c_3521_17154496ef7a["markComponentRenderStarted()"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|calls| 1df0dd5b_17c8_c98c_3521_17154496ef7a c88117c7_b46d_b4e4_536c_462d4e08c01e["markComponentRenderStopped()"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|calls| c88117c7_b46d_b4e4_536c_462d4e08c01e 6cb202e6_76dc_0479_ff31_d0ef23610882["bailoutOnAlreadyFinishedWork()"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|calls| 6cb202e6_76dc_0479_ff31_d0ef23610882 dae8f65a_04a5_194b_7c97_c4819e519207["getIsHydrating()"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|calls| dae8f65a_04a5_194b_7c97_c4819e519207 cf5641cc_b89e_d6b2_5d40_41ad5bbdd682["reconcileChildren()"] f3abfeea_868f_5c8e_9744_74c9973ded12 -->|calls| cf5641cc_b89e_d6b2_5d40_41ad5bbdd682 style f3abfeea_868f_5c8e_9744_74c9973ded12 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberBeginWork.js lines 405–469
function updateForwardRef(
current: Fiber | null,
workInProgress: Fiber,
Component: any,
nextProps: any,
renderLanes: Lanes,
) {
// TODO: current can be non-null here even if the component
// hasn't yet mounted. This happens after the first render suspends.
// We'll need to figure out if this is fine or can cause issues.
const render = Component.render;
const ref = workInProgress.ref;
let propsWithoutRef;
if ('ref' in nextProps) {
// `ref` is just a prop now, but `forwardRef` expects it to not appear in
// the props object. This used to happen in the JSX runtime, but now we do
// it here.
propsWithoutRef = ({}: {[string]: any});
for (const key in nextProps) {
// Since `ref` should only appear in props via the JSX transform, we can
// assume that this is a plain object. So we don't need a
// hasOwnProperty check.
if (key !== 'ref') {
propsWithoutRef[key] = nextProps[key];
}
}
} else {
propsWithoutRef = nextProps;
}
// The rest is a fork of updateFunctionComponent
prepareToReadContext(workInProgress, renderLanes);
if (enableSchedulingProfiler) {
markComponentRenderStarted(workInProgress);
}
const nextChildren = renderWithHooks(
current,
workInProgress,
render,
propsWithoutRef,
ref,
renderLanes,
);
const hasId = checkDidRenderIdHook();
if (enableSchedulingProfiler) {
markComponentRenderStopped();
}
if (current !== null && !didReceiveUpdate) {
bailoutHooks(current, workInProgress, renderLanes);
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
}
if (getIsHydrating() && hasId) {
pushMaterializedTreeId(workInProgress);
}
// React DevTools reads this flag.
workInProgress.flags |= PerformedWork;
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
return workInProgress.child;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does updateForwardRef() do?
updateForwardRef() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is updateForwardRef() defined?
updateForwardRef() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 405.
What does updateForwardRef() call?
updateForwardRef() calls 5 function(s): bailoutOnAlreadyFinishedWork, getIsHydrating, markComponentRenderStarted, markComponentRenderStopped, reconcileChildren.
What calls updateForwardRef()?
updateForwardRef() is called by 2 function(s): beginWork, updateHostRoot.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free