Created
April 30, 2015 03:52
-
-
Save carlosdlf/1000b3e6efed94684aa9 to your computer and use it in GitHub Desktop.
React input text
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
/** | |
* Created by clarico on 29/04/2015. | |
*/ | |
var App; | |
App = React.createClass({ | |
getInitialState: function () { | |
return { | |
txt: "the state txt", | |
id: 0 | |
} | |
}, | |
update: function (e) { | |
this.setState({txt: e.target.value}); | |
}, | |
render: function () { | |
return ( | |
<div> | |
<h1>{this.props.txt}</h1> | |
<input type="text" onChange={this.update}/> | |
<h1>{this.state.txt}</h1> | |
</div> | |
); | |
} | |
}); | |
React.render(<App txt="Ingrese su nombre"/>, document.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment