Created
March 26, 2016 20:43
-
-
Save KCreate/d9caa5b323f3d05e1d05 to your computer and use it in GitHub Desktop.
React inverter
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
var Inverter = React.createClass({ | |
getInitialState: function() { | |
return { | |
text: "" | |
}; | |
}, | |
textChange: function(event) { | |
this.setState({ | |
text: event.target.value | |
}); | |
}, | |
render: function() { | |
return ( | |
<div> | |
<input onChange={this.textChange} value={this.state.text}></input> | |
<h1>{this.state.text.split('').reverse().join('')}</h1> | |
</div> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment