Consumer Class — react Architecture
Architecture documentation for the Consumer class in ReactContextPropagation-test.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 42e9fa8e_1455_85a7_5902_1f5216da78b9["Consumer"] 0083cf58_7ee0_6a4b_9e2a_0c45dbf60f52["ReactContextPropagation-test.js"] 42e9fa8e_1455_85a7_5902_1f5216da78b9 -->|defined in| 0083cf58_7ee0_6a4b_9e2a_0c45dbf60f52 c31d24f9_d153_6ade_3f34_1b179f41c5a3["render()"] 42e9fa8e_1455_85a7_5902_1f5216da78b9 -->|method| c31d24f9_d153_6ade_3f34_1b179f41c5a3
Relationship Graph
Source Code
packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js lines 272–280
class Consumer extends React.PureComponent {
static contextType = Context;
render() {
// Even though Consumer is memoized, Consumer should re-render
// DeepChild whenever the context value changes. Otherwise DeepChild
// won't receive the new value.
return <DeepChild value={this.context} />;
}
}
Source
Frequently Asked Questions
What is the Consumer class?
Consumer is a class in the react codebase, defined in packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js.
Where is Consumer defined?
Consumer is defined in packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js at line 272.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free