Home / Class/ ConsumerTree Class — react Architecture

ConsumerTree Class — react Architecture

Architecture documentation for the ConsumerTree class in ReactNewContext-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0987dd43_7572_60b9_a186_d064f3a52a20["ConsumerTree"]
  382e7256_eb32_dd1d_b5d7_fa78a7166483["ReactNewContext-test.js"]
  0987dd43_7572_60b9_a186_d064f3a52a20 -->|defined in| 382e7256_eb32_dd1d_b5d7_fa78a7166483
  a876b85e_8d89_5480_b1f2_278c560c899d["shouldComponentUpdate()"]
  0987dd43_7572_60b9_a186_d064f3a52a20 -->|method| a876b85e_8d89_5480_b1f2_278c560c899d
  d7d0e782_986c_5f28_c10c_5b793766136b["render()"]
  0987dd43_7572_60b9_a186_d064f3a52a20 -->|method| d7d0e782_986c_5f28_c10c_5b793766136b

Relationship Graph

Source Code

packages/react-reconciler/src/__tests__/ReactNewContext-test.js lines 1511–1543

      class ConsumerTree extends React.Component {
        shouldComponentUpdate() {
          return false;
        }
        render() {
          Scheduler.log();
          if (this.props.depth >= this.props.maxDepth) {
            return null;
          }
          const consumers = [0, 1, 2].map(i => {
            const randomKey =
              contextKeys[
                this.props.rand.intBetween(0, contextKeys.length - 1)
              ];
            const Context = contexts.get(randomKey);
            return (
              <Context.Consumer key={i}>
                {value => (
                  <>
                    <span prop={`${randomKey}:${value}`} />
                    <ConsumerTree
                      rand={this.props.rand}
                      depth={this.props.depth + 1}
                      maxDepth={this.props.maxDepth}
                    />
                  </>
                )}
              </Context.Consumer>
            );
          });
          return consumers;
        }
      }

Frequently Asked Questions

What is the ConsumerTree class?
ConsumerTree is a class in the react codebase, defined in packages/react-reconciler/src/__tests__/ReactNewContext-test.js.
Where is ConsumerTree defined?
ConsumerTree is defined in packages/react-reconciler/src/__tests__/ReactNewContext-test.js at line 1511.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free