Home / File/ ListApp.js — react Source File

ListApp.js — react Source File

Architecture documentation for ListApp.js, a javascript file in the react codebase. 1 imports, 2 dependents.

File javascript BabelCompiler Validation 1 imports 2 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  c0933170_04c4_21bd_1ed5_38c7df2e0db6["ListApp.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  c0933170_04c4_21bd_1ed5_38c7df2e0db6 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  d0eeac21_8285_7c0f_29f9_523d1b9b57a1["app-legacy.js"]
  d0eeac21_8285_7c0f_29f9_523d1b9b57a1 --> c0933170_04c4_21bd_1ed5_38c7df2e0db6
  122f1cac_b9af_849e_a931_f1190d751e00["app.js"]
  122f1cac_b9af_849e_a931_f1190d751e00 --> c0933170_04c4_21bd_1ed5_38c7df2e0db6
  style c0933170_04c4_21bd_1ed5_38c7df2e0db6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {useRef, useState} from 'react';

export default function App(): React.Node {
  return <List />;
}

function List() {
  const [items, setItems] = useState(['one', 'two', 'three']);
  const inputRef = useRef(null);

  const addItem = () => {
    const input = ((inputRef.current: any): HTMLInputElement);
    const text = input.value;
    input.value = '';

    if (text) {
      setItems([...items, text]);
    }
  };

  return (
    <>
      <input ref={inputRef} data-testname="AddItemInput" />
      <button data-testname="AddItemButton" onClick={addItem}>
        Add Item
      </button>
      <ul data-testname="List">
        {items.map((label, index) => (
          <ListItem key={index} label={label} />
        ))}
      </ul>
    </>
  );
}

// $FlowFixMe[missing-local-annot]
function ListItem({label}) {
  return <li data-testname="ListItem">{label}</li>;
}

Domain

Subdomains

Dependencies

  • react

Frequently Asked Questions

What does ListApp.js do?
ListApp.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ListApp.js?
ListApp.js defines 3 function(s): App, List, ListItem.
What does ListApp.js depend on?
ListApp.js imports 1 module(s): react.
What files import ListApp.js?
ListApp.js is imported by 2 file(s): app-legacy.js, app.js.
Where is ListApp.js in the architecture?
ListApp.js is located at packages/react-devtools-shell/src/e2e-apps/ListApp.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shell/src/e2e-apps).

Analyze Your Own Codebase

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

Try Supermodel Free