Home / Class/ SuspendyTreeChild Class — react Architecture

SuspendyTreeChild Class — react Architecture

Architecture documentation for the SuspendyTreeChild class in index.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6a594782_d528_12c1_5083_49cda695f364["SuspendyTreeChild"]
  bc541b6e_9521_11e1_5e2b_622a6b2d721e["index.js"]
  6a594782_d528_12c1_5083_49cda695f364 -->|defined in| bc541b6e_9521_11e1_5e2b_622a6b2d721e
  68a294fb_eb36_5990_dd1f_5e513db0c3e0["componentDidMount()"]
  6a594782_d528_12c1_5083_49cda695f364 -->|method| 68a294fb_eb36_5990_dd1f_5e513db0c3e0
  f5387d45_a83d_9f33_64aa_a6ce1beed9a0["componentWillUnmount()"]
  6a594782_d528_12c1_5083_49cda695f364 -->|method| f5387d45_a83d_9f33_64aa_a6ce1beed9a0
  8897e5bb_5ac8_e345_b44e_393167fb7308["render()"]
  6a594782_d528_12c1_5083_49cda695f364 -->|method| 8897e5bb_5ac8_e345_b44e_393167fb7308

Relationship Graph

Source Code

fixtures/dom/src/components/fixtures/suspense/index.js lines 25–60

class SuspendyTreeChild extends React.Component {
  id = suspendyTreeIdCounter++;
  state = {
    step: 1,
    isHidden: false,
  };
  increment = () => this.setState(s => ({step: s.step + 1}));

  componentDidMount() {
    document.addEventListener('keydown', this.onKeydown);
  }

  componentWillUnmount() {
    document.removeEventListener('keydown', this.onKeydown);
  }

  onKeydown = event => {
    if (event.metaKey && event.key === 'Enter') {
      this.increment();
    }
  };

  render() {
    return (
      <>
        <Suspense fallback={<div>(display: none)</div>}>
          <div>
            <AsyncStep text={`${this.state.step} + ${this.id}`} ms={500} />
            {this.props.children}
          </div>
        </Suspense>
        <button onClick={this.increment}>Hide</button>
      </>
    );
  }
}

Domain

Frequently Asked Questions

What is the SuspendyTreeChild class?
SuspendyTreeChild is a class in the react codebase, defined in fixtures/dom/src/components/fixtures/suspense/index.js.
Where is SuspendyTreeChild defined?
SuspendyTreeChild is defined in fixtures/dom/src/components/fixtures/suspense/index.js at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free