Home / Class/ List Class — react Architecture

List Class — react Architecture

Architecture documentation for the List class in ListAppLegacy.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3d189cba_be5b_cdaa_0084_90158e45e3dd["List"]
  afbe0e94_9107_c22a_44d8_dc43ee591bc4["ListAppLegacy.js"]
  3d189cba_be5b_cdaa_0084_90158e45e3dd -->|defined in| afbe0e94_9107_c22a_44d8_dc43ee591bc4
  64726379_8443_c2b3_c2d2_6b1016316f25["constructor()"]
  3d189cba_be5b_cdaa_0084_90158e45e3dd -->|method| 64726379_8443_c2b3_c2d2_6b1016316f25
  d3f107dc_dd04_ff63_8d07_32e8e415eee6["render()"]
  3d189cba_be5b_cdaa_0084_90158e45e3dd -->|method| d3f107dc_dd04_ff63_8d07_32e8e415eee6

Relationship Graph

Source Code

packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js lines 16–51

class List extends React.Component {
  constructor(props: any) {
    super(props);
    this.state = {
      items: ['one', 'two', 'three'],
    };
  }

  addItem = () => {
    if (this.inputRef && this.inputRef.value) {
      this.setState({items: [...this.state.items, this.inputRef.value]});
      this.inputRef.value = '';
    }
  };

  render(): any {
    return (
      <div>
        <input
          data-testname="AddItemInput"
          value={this.state.text}
          onChange={this.onInputChange}
          ref={c => (this.inputRef = c)}
        />
        <button data-testname="AddItemButton" onClick={this.addItem}>
          Add Item
        </button>
        <ul data-testname="List">
          {this.state.items.map((label, index) => (
            <ListItem key={index} label={label} />
          ))}
        </ul>
      </div>
    );
  }
}

Domain

Frequently Asked Questions

What is the List class?
List is a class in the react codebase, defined in packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js.
Where is List defined?
List is defined in packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js at line 16.

Analyze Your Own Codebase

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

Try Supermodel Free