Home / Class/ Boundary Class — react Architecture

Boundary Class — react Architecture

Architecture documentation for the Boundary class in ReactTestRenderer-test.internal.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e9952311_20c6_6ccc_21a2_29edba02edf3["Boundary"]
  87a09f9b_1b95_2e51_6318_1fd839e7a9c5["ReactTestRenderer-test.internal.js"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|defined in| 87a09f9b_1b95_2e51_6318_1fd839e7a9c5
  746228a4_fc44_4004_0f6b_357b6d971319["constructor()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| 746228a4_fc44_4004_0f6b_357b6d971319
  3d928d30_08fc_8e18_038c_b54ac7a272a5["render()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| 3d928d30_08fc_8e18_038c_b54ac7a272a5
  c33a2705_08f5_68f3_a7ee_ffa6ad7f2d9f["componentDidMount()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| c33a2705_08f5_68f3_a7ee_ffa6ad7f2d9f
  1bb8bf43_b250_695e_7fa8_5e4480205036["componentWillUnmount()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| 1bb8bf43_b250_695e_7fa8_5e4480205036
  e898c2f4_1905_5f67_7225_64b20f74bad4["onClick()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| e898c2f4_1905_5f67_7225_64b20f74bad4
  899b4518_079d_71dd_6905_2bef79757e11["componentDidCatch()"]
  e9952311_20c6_6ccc_21a2_29edba02edf3 -->|method| 899b4518_079d_71dd_6905_2bef79757e11

Relationship Graph

Source Code

packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js lines 548–579

    class Boundary extends React.Component {
      constructor(props) {
        super(props);
        this.state = {error: false};
      }
      render() {
        log.push('Boundary render');
        if (!this.state.error) {
          return (
            <div>
              <button onClick={this.onClick}>ClickMe</button>
              <Angry />
            </div>
          );
        } else {
          return <div>Happy Birthday!</div>;
        }
      }
      componentDidMount() {
        log.push('Boundary componentDidMount');
      }
      componentWillUnmount() {
        log.push('Boundary componentWillUnmount');
      }
      onClick() {
        /* do nothing */
      }
      componentDidCatch() {
        log.push('Boundary componentDidCatch');
        this.setState({error: true});
      }
    }

Frequently Asked Questions

What is the Boundary class?
Boundary is a class in the react codebase, defined in packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js.
Where is Boundary defined?
Boundary is defined in packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js at line 548.

Analyze Your Own Codebase

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

Try Supermodel Free