Home / Class/ InputPlaceholderFixture Class — react Architecture

InputPlaceholderFixture Class — react Architecture

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

Entity Profile

Dependency Diagram

graph TD
  de1b5ac7_be48_ea0c_e57e_1c5cf5538075["InputPlaceholderFixture"]
  c06b8d5e_52d1_3bc6_33c8_4a36d75347fc["InputPlaceholderFixture.js"]
  de1b5ac7_be48_ea0c_e57e_1c5cf5538075 -->|defined in| c06b8d5e_52d1_3bc6_33c8_4a36d75347fc
  9a016006_c4b9_f0bd_6c1c_03c4915e11dd["constructor()"]
  de1b5ac7_be48_ea0c_e57e_1c5cf5538075 -->|method| 9a016006_c4b9_f0bd_6c1c_03c4915e11dd
  189980d4_47fe_1ec0_60c2_17f8ac2818ac["render()"]
  de1b5ac7_be48_ea0c_e57e_1c5cf5538075 -->|method| 189980d4_47fe_1ec0_60c2_17f8ac2818ac

Relationship Graph

Source Code

fixtures/dom/src/components/fixtures/input-change-events/InputPlaceholderFixture.js lines 4–56

class InputPlaceholderFixture extends React.Component {
  constructor(props, context) {
    super(props, context);

    this.state = {
      placeholder: 'A placeholder',
      changeCount: 0,
    };
  }

  handleChange = () => {
    this.setState(({changeCount}) => {
      return {
        changeCount: changeCount + 1,
      };
    });
  };
  handleGeneratePlaceholder = () => {
    this.setState({
      placeholder: `A placeholder: ${Math.random() * 100}`,
    });
  };

  handleReset = () => {
    this.setState({
      changeCount: 0,
    });
  };

  render() {
    const {placeholder, changeCount} = this.state;
    const color = changeCount === 0 ? 'green' : 'red';

    return (
      <Fixture>
        <input
          type="text"
          placeholder={placeholder}
          onChange={this.handleChange}
        />{' '}
        <button onClick={this.handleGeneratePlaceholder}>
          Change placeholder
        </button>
        <p style={{color}}>
          <code>onChange</code>
          {' calls: '}
          <strong>{changeCount}</strong>
        </p>
        <button onClick={this.handleReset}>Reset count</button>
      </Fixture>
    );
  }
}

Domain

Frequently Asked Questions

What is the InputPlaceholderFixture class?
InputPlaceholderFixture is a class in the react codebase, defined in fixtures/dom/src/components/fixtures/input-change-events/InputPlaceholderFixture.js.
Where is InputPlaceholderFixture defined?
InputPlaceholderFixture is defined in fixtures/dom/src/components/fixtures/input-change-events/InputPlaceholderFixture.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free