Home / Class/ Leaf Class — react Architecture

Leaf Class — react Architecture

Architecture documentation for the Leaf class in ReactLegacyCompositeComponent-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e7d7ecb6_40da_8ccc_2040_2d7db0e28099["Leaf"]
  3b351a1f_faad_fff4_44c6_33b8718b45d0["ReactLegacyCompositeComponent-test.js"]
  e7d7ecb6_40da_8ccc_2040_2d7db0e28099 -->|defined in| 3b351a1f_faad_fff4_44c6_33b8718b45d0
  35f4a521_4d3e_7ae2_079b_31827498dba4["UNSAFE_componentWillReceiveProps()"]
  e7d7ecb6_40da_8ccc_2040_2d7db0e28099 -->|method| 35f4a521_4d3e_7ae2_079b_31827498dba4
  a6e7b08e_ec06_42e9_a69d_31616793293b["shouldComponentUpdate()"]
  e7d7ecb6_40da_8ccc_2040_2d7db0e28099 -->|method| a6e7b08e_ec06_42e9_a69d_31616793293b
  6165385d_dde5_69c7_667e_0127a618fb45["render()"]
  e7d7ecb6_40da_8ccc_2040_2d7db0e28099 -->|method| 6165385d_dde5_69c7_667e_0127a618fb45

Relationship Graph

Source Code

packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js lines 439–456

    class Leaf extends React.Component {
      static contextTypes = {
        foo: PropTypes.string.isRequired,
      };

      UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
        expect('foo' in nextContext).toBe(true);
      }

      shouldComponentUpdate(nextProps, nextState, nextContext) {
        expect('foo' in nextContext).toBe(true);
        return true;
      }

      render() {
        return <span>{this.context.foo}</span>;
      }
    }

Frequently Asked Questions

What is the Leaf class?
Leaf is a class in the react codebase, defined in packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js.
Where is Leaf defined?
Leaf is defined in packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js at line 439.

Analyze Your Own Codebase

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

Try Supermodel Free