Home / Class/ ChildWithContext Class — react Architecture

ChildWithContext Class — react Architecture

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

Entity Profile

Dependency Diagram

graph TD
  330b38b4_95bb_ec05_5b5d_0e308d57a682["ChildWithContext"]
  3b351a1f_faad_fff4_44c6_33b8718b45d0["ReactLegacyCompositeComponent-test.js"]
  330b38b4_95bb_ec05_5b5d_0e308d57a682 -->|defined in| 3b351a1f_faad_fff4_44c6_33b8718b45d0
  ff022758_0cbc_e494_57e4_c14d9ac5ed55["UNSAFE_componentWillReceiveProps()"]
  330b38b4_95bb_ec05_5b5d_0e308d57a682 -->|method| ff022758_0cbc_e494_57e4_c14d9ac5ed55
  ff6288fa_d22f_65be_2c25_849c3c9c00ef["render()"]
  330b38b4_95bb_ec05_5b5d_0e308d57a682 -->|method| ff6288fa_d22f_65be_2c25_849c3c9c00ef

Relationship Graph

Source Code

packages/react-dom/src/__tests__/ReactLegacyCompositeComponent-test.js lines 538–558

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

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

        if (nextProps !== this.props) {
          propChanges++;
        }

        if (nextContext !== this.context) {
          contextChanges++;
        }
      }

      render() {
        return <div className="child-with">{this.props.children}</div>;
      }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free