Skip to content

Instantly share code, notes, and snippets.

@KCreate
Created March 26, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KCreate/d9caa5b323f3d05e1d05 to your computer and use it in GitHub Desktop.
Save KCreate/d9caa5b323f3d05e1d05 to your computer and use it in GitHub Desktop.
React inverter
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