Home / Class/ Foo Class — react Architecture

Foo Class — react Architecture

Architecture documentation for the Foo class in ReactIncrementalScheduling-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  cc31469a_2801_f839_c9fc_d1d2f1869f7a["Foo"]
  02e187d6_a113_f9ed_e188_0379fdbe2067["ReactIncrementalScheduling-test.js"]
  cc31469a_2801_f839_c9fc_d1d2f1869f7a -->|defined in| 02e187d6_a113_f9ed_e188_0379fdbe2067
  c564efbb_e632_6029_013f_bd1c4562b3c6["componentDidMount()"]
  cc31469a_2801_f839_c9fc_d1d2f1869f7a -->|method| c564efbb_e632_6029_013f_bd1c4562b3c6
  4bbe3ae6_b9a4_b371_93e4_094a72413e9c["componentDidUpdate()"]
  cc31469a_2801_f839_c9fc_d1d2f1869f7a -->|method| 4bbe3ae6_b9a4_b371_93e4_094a72413e9c
  4766b585_7335_b715_6151_e8e8a3633002["render()"]
  cc31469a_2801_f839_c9fc_d1d2f1869f7a -->|method| 4766b585_7335_b715_6151_e8e8a3633002

Relationship Graph

Source Code

packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js lines 150–181

    class Foo extends React.Component {
      state = {tick: 0};

      componentDidMount() {
        Scheduler.log(
          'componentDidMount (before setState): ' + this.state.tick,
        );
        this.setState({tick: 1});
        // We're in a batch. Update hasn't flushed yet.
        Scheduler.log('componentDidMount (after setState): ' + this.state.tick);
      }

      componentDidUpdate() {
        Scheduler.log('componentDidUpdate: ' + this.state.tick);
        if (this.state.tick === 2) {
          Scheduler.log(
            'componentDidUpdate (before setState): ' + this.state.tick,
          );
          this.setState({tick: 3});
          Scheduler.log(
            'componentDidUpdate (after setState): ' + this.state.tick,
          );
          // We're in a batch. Update hasn't flushed yet.
        }
      }

      render() {
        Scheduler.log('render: ' + this.state.tick);
        instance = this;
        return <span prop={this.state.tick} />;
      }
    }

Frequently Asked Questions

What is the Foo class?
Foo is a class in the react codebase, defined in packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js.
Where is Foo defined?
Foo is defined in packages/react-reconciler/src/__tests__/ReactIncrementalScheduling-test.js at line 150.

Analyze Your Own Codebase

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

Try Supermodel Free