Created
April 30, 2015 19:47
-
-
Save carlosdlf/6be561e682111ec66162 to your computer and use it in GitHub Desktop.
Widget Basic ReactJs
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 = React.createClass({ | |
getInitialState: function () { | |
return { | |
txt: "" | |
} | |
}, | |
update: function (e) { | |
this.setState({txt: e.target.value}); | |
}, | |
render: function () { | |
return ( | |
<div> | |
<Widget txt={this.state.txt} update={this.update}/> | |
<Widget txt={this.state.txt} update={this.update}/> | |
<Widget txt={this.state.txt} update={this.update}/> | |
<Widget txt={this.state.txt} update={this.update}/> | |
<Widget txt={this.state.txt} update={this.update}/> | |
</div> | |
); | |
} | |
}); | |
var Widget = React.createClass({ | |
render:function(){ | |
return ( | |
<div> | |
<input type="text" onChange={this.props.update} /> | |
<br/> | |
<b>{this.props.txt}</b> | |
</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