Last active
July 26, 2017 07:14
-
-
Save enkot/b9a50efbd2a7af27aa9506c56112d0a0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
class Welcome extends React.Component { | |
constructor(props) { | |
super(props); | |
this.handleChange = this.handleChange.bind(this); | |
this.state = {name: 'Medium'}; | |
} | |
handleChange(e) { | |
this.setState({name: e.target.value}); | |
} | |
render() { | |
return ( | |
<div style={{textAlign: 'center'}}> | |
<h1>Welcome</h1> | |
<p>Hello {this.state.name}</p> | |
<input onChange={this.handleChange} defaultValue={this.state.name}/> | |
</div> | |
); | |
} | |
} | |
ReactDOM.render(<Welcome/>, document.getElementById('app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment