MCPcopy
hub / github.com/react/react / prepareToReadContext

Function prepareToReadContext

packages/react-reconciler/src/ReactFiberNewContext.js:488–500  ·  view source on GitHub ↗
(
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

486}
487
488export function prepareToReadContext(
489 workInProgress: Fiber,
490 renderLanes: Lanes,
491): void {
492 currentlyRenderingFiber = workInProgress;
493 lastContextDependency = null;
494
495 const dependencies = workInProgress.dependencies;
496 if (dependencies !== null) {
497 // Reset the work-in-progress list
498 dependencies.firstContext = null;
499 }
500}
501
502export function readContext<T>(context: ReactContext<T>): T {
503 if (__DEV__) {

Callers 8

updateForwardRefFunction · 0.90
updateCacheComponentFunction · 0.90
updateFunctionComponentFunction · 0.90
replayFunctionComponentFunction · 0.90
updateClassComponentFunction · 0.90
updateContextConsumerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected