Last active
July 5, 2018 05:54
-
-
Save DiegoPinho/b74e1be45fc0b5255e7a26dbdad66daa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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