Skip to content

Instantly share code, notes, and snippets.

@leolana
Forked from DiegoPinho/demo-estados.jsx
Created July 5, 2018 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leolana/8087c7051af650c2f24c61cfbb87d431 to your computer and use it in GitHub Desktop.
Save leolana/8087c7051af650c2f24c61cfbb87d431 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Espelho from './Espelho';
class App extends Component {
constructor(props) {
super(props);
this.state = {
input: ''
}
this.alterarTexto = this.alterarTexto.bind(this);
}
alterarTexto(evento) {
this.setState({
input: evento.target.value
})
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
<br />
<p>Texto: </p><input value={this.state.input} onChange={this.alterarTexto} />
<Espelho texto={this.state.input} />
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment