Home / File/ InputPlaceholderFixture.js — react Source File

InputPlaceholderFixture.js — react Source File

Architecture documentation for InputPlaceholderFixture.js, a javascript file in the react codebase. 3 imports, 1 dependents.

File javascript BabelCompiler Optimization 3 imports 1 dependents 1 classes

Entity Profile

Dependency Diagram

graph LR
  c06b8d5e_52d1_3bc6_33c8_4a36d75347fc["InputPlaceholderFixture.js"]
  bc8ae172_cc20_3692_943c_bbdb1ad34855["Fixture.js"]
  c06b8d5e_52d1_3bc6_33c8_4a36d75347fc --> bc8ae172_cc20_3692_943c_bbdb1ad34855
  2851624d_a736_f3f6_2132_5a20630983fe["Fixture"]
  c06b8d5e_52d1_3bc6_33c8_4a36d75347fc --> 2851624d_a736_f3f6_2132_5a20630983fe
  a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb["Fixture"]
  c06b8d5e_52d1_3bc6_33c8_4a36d75347fc --> a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb
  ba53c75f_b711_f8f4_9a77_b020529fa33b["index.js"]
  ba53c75f_b711_f8f4_9a77_b020529fa33b --> c06b8d5e_52d1_3bc6_33c8_4a36d75347fc
  style c06b8d5e_52d1_3bc6_33c8_4a36d75347fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Fixture from '../../Fixture';
const React = window.React;

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>
    );
  }
}

export default InputPlaceholderFixture;

Domain

Subdomains

Frequently Asked Questions

What does InputPlaceholderFixture.js do?
InputPlaceholderFixture.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What does InputPlaceholderFixture.js depend on?
InputPlaceholderFixture.js imports 3 module(s): Fixture, Fixture, Fixture.js.
What files import InputPlaceholderFixture.js?
InputPlaceholderFixture.js is imported by 1 file(s): index.js.
Where is InputPlaceholderFixture.js in the architecture?
InputPlaceholderFixture.js is located at fixtures/dom/src/components/fixtures/input-change-events/InputPlaceholderFixture.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components/fixtures/input-change-events).

Analyze Your Own Codebase

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

Try Supermodel Free