Home / Class/ App Class — react Architecture

App Class — react Architecture

Architecture documentation for the App class in App.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7796199a_976b_30de_2bf9_e72aa702c083["App"]
  444f4239_c2fb_3bc5_1037_eb595d98f6e1["App.js"]
  7796199a_976b_30de_2bf9_e72aa702c083 -->|defined in| 444f4239_c2fb_3bc5_1037_eb595d98f6e1
  aa71aa4f_3ada_7570_6469_04d2e34e4b02["componentDidMount()"]
  7796199a_976b_30de_2bf9_e72aa702c083 -->|method| aa71aa4f_3ada_7570_6469_04d2e34e4b02
  beb7074a_2384_4b98_8fdf_82ff0b15b5c5["componentWillUpdate()"]
  7796199a_976b_30de_2bf9_e72aa702c083 -->|method| beb7074a_2384_4b98_8fdf_82ff0b15b5c5
  af493b9a_23a7_2ac8_0705_a73027025095["getAttributes()"]
  7796199a_976b_30de_2bf9_e72aa702c083 -->|method| af493b9a_23a7_2ac8_0705_a73027025095
  de1a7d40_fb4e_d77c_893a_dfa22cf58ef3["render()"]
  7796199a_976b_30de_2bf9_e72aa702c083 -->|method| de1a7d40_fb4e_d77c_893a_dfa22cf58ef3

Relationship Graph

Source Code

fixtures/attribute-behavior/src/App.js lines 760–1053

class App extends React.Component {
  state = {
    sortOrder: ALPHABETICAL,
    filter: ALL,
    completedHashes: restoreFromLocalStorage(),
    table: null,
    rowPatternHashes: null,
  };

  renderCell = ({key, ...props}) => {
    return (
      <div key={key} style={props.style}>
        <CellContent
          toggleAttribute={this.toggleAttribute}
          completedHashes={this.state.completedHashes}
          table={this.state.table}
          attributesInSortedOrder={this.attributes}
          {...props}
        />
      </div>
    );
  };

  onUpdateSort = e => {
    this.setState({sortOrder: e.target.value});
  };

  onUpdateFilter = e => {
    this.setState({filter: e.target.value});
  };

  toggleAttribute = rowPatternHash => {
    const completedHashes = new Set(this.state.completedHashes);
    if (completedHashes.has(rowPatternHash)) {
      completedHashes.delete(rowPatternHash);
    } else {
      completedHashes.add(rowPatternHash);
    }
    this.setState({completedHashes}, () => saveToLocalStorage(completedHashes));
  };

  async componentDidMount() {
    const sources = {
      ReactStable: 'https://unpkg.com/react@latest/umd/react.development.js',
      ReactDOMStable:
        'https://unpkg.com/react-dom@latest/umd/react-dom.development.js',
      ReactDOMServerStable:
        'https://unpkg.com/react-dom@latest/umd/react-dom-server.browser.development.js',
      ReactNext: '/react.development.js',
      ReactDOMNext: '/react-dom.development.js',
      ReactDOMServerNext: '/react-dom-server.browser.development.js',
    };
    const codePromises = Object.values(sources).map(src =>
      fetch(src).then(res => res.text())
    );
    const codesByIndex = await Promise.all(codePromises);

    const pool = [];
    function initGlobals(attribute, type) {
      if (useFastMode) {
        // Note: this is not giving correct results for warnings.
        // But it's much faster.
        if (pool[0]) {
          return pool[0].globals;
        }
      } else {
        document.title = `${attribute.name} (${type.name})`;
      }

      // Creating globals for every single test is too slow.
      // However caching them between runs won't work for the same attribute names
      // because warnings will be deduplicated. As a result, we only share globals
      // between different attribute names.
      for (let i = 0; i < pool.length; i++) {
        if (!pool[i].testedAttributes.has(attribute.name)) {
          pool[i].testedAttributes.add(attribute.name);
          return pool[i].globals;
        }
      }

      let globals = {};

Domain

Frequently Asked Questions

What is the App class?
App is a class in the react codebase, defined in fixtures/attribute-behavior/src/App.js.
Where is App defined?
App is defined in fixtures/attribute-behavior/src/App.js at line 760.

Analyze Your Own Codebase

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

Try Supermodel Free