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

Function updateContextProvider

packages/react-reconciler/src/ReactFiberBeginWork.js:3607–3632  ·  view source on GitHub ↗
(
  current: Fiber | null,
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

3605let hasWarnedAboutUsingNoValuePropOnContextProvider = false;
3606
3607function updateContextProvider(
3608 current: Fiber | null,
3609 workInProgress: Fiber,
3610 renderLanes: Lanes,
3611) {
3612 const context: ReactContext<any> = workInProgress.type;
3613 const newProps = workInProgress.pendingProps;
3614 const newValue = newProps.value;
3615
3616 if (__DEV__) {
3617 if (!('value' in newProps)) {
3618 if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
3619 hasWarnedAboutUsingNoValuePropOnContextProvider = true;
3620 console.error(
3621 'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
3622 );
3623 }
3624 }
3625 }
3626
3627 pushProvider(workInProgress, context, newValue);
3628
3629 const newChildren = newProps.children;
3630 reconcileChildren(current, workInProgress, newChildren, renderLanes);
3631 return workInProgress.child;
3632}
3633
3634function updateContextConsumer(
3635 current: Fiber | null,

Callers 1

beginWorkFunction · 0.85

Calls 3

pushProviderFunction · 0.90
reconcileChildrenFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected