Home / Class/ Button Class — react Architecture

Button Class — react Architecture

Architecture documentation for the Button class in SimpleEventPlugin-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8cb18f41_3b54_f8a6_31bb_bdcf288365c1["Button"]
  fd2a7572_a239_84c5_40c9_baec55f560be["SimpleEventPlugin-test.js"]
  8cb18f41_3b54_f8a6_31bb_bdcf288365c1 -->|defined in| fd2a7572_a239_84c5_40c9_baec55f560be
  ef6afdef_cec0_fddd_8d22_3a5d462c4695["componentDidUpdate()"]
  8cb18f41_3b54_f8a6_31bb_bdcf288365c1 -->|method| ef6afdef_cec0_fddd_8d22_3a5d462c4695
  cb43a8e4_f546_d8dc_4c8c_d8856ea80e4c["render()"]
  8cb18f41_3b54_f8a6_31bb_bdcf288365c1 -->|method| cb43a8e4_f546_d8dc_4c8c_d8856ea80e4c

Relationship Graph

Source Code

packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js lines 219–244

    class Button extends React.Component {
      state = {count: 0};
      increment = () =>
        this.setState(state => ({
          count: state.count + 1,
        }));
      componentDidUpdate() {
        Scheduler.log(`didUpdate - Count: ${this.state.count}`);
      }
      render() {
        return (
          <button
            ref={el => (button = el)}
            onFocus={this.increment}
            onClick={() => {
              // The focus call synchronously dispatches a nested event. All of
              // the updates in this handler should be batched together.
              this.increment();
              button.focus();
              this.increment();
            }}>
            Count: {this.state.count}
          </button>
        );
      }
    }

Frequently Asked Questions

What is the Button class?
Button is a class in the react codebase, defined in packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js.
Where is Button defined?
Button is defined in packages/react-dom/src/events/plugins/__tests__/SimpleEventPlugin-test.js at line 219.

Analyze Your Own Codebase

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

Try Supermodel Free