MCPcopy Index your code
hub / github.com/react/react / collectNearestContextValues

Function collectNearestContextValues

packages/react-reconciler/src/ReactFiberScope.js:111–129  ·  view source on GitHub ↗
(
  node: Fiber,
  context: ReactContext<T>,
  childContextValues: Array<T>,
)

Source from the content-addressed store, hash-verified

109}
110
111function collectNearestContextValues<T>(
112 node: Fiber,
113 context: ReactContext<T>,
114 childContextValues: Array<T>,
115): void {
116 if (node.tag === ContextProvider && node.type === context) {
117 const contextValue = node.memoizedProps.value;
118 childContextValues.push(contextValue);
119 } else {
120 let child = node.child;
121
122 if (isFiberSuspenseAndTimedOut(node)) {
123 child = getSuspenseFallbackChild(node);
124 }
125 if (child !== null) {
126 collectNearestChildContextValues(child, context, childContextValues);
127 }
128 }
129}
130
131function collectNearestChildContextValues<T>(
132 startingChild: Fiber | null,

Callers 1

Calls 4

getSuspenseFallbackChildFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected