Skip to content

Instantly share code, notes, and snippets.

@carlosdlf
Created April 30, 2015 03:52
Show Gist options
  • Save carlosdlf/1000b3e6efed94684aa9 to your computer and use it in GitHub Desktop.
Save carlosdlf/1000b3e6efed94684aa9 to your computer and use it in GitHub Desktop.
React input text
/**
* 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