Skip to content

Instantly share code, notes, and snippets.

@tomask-de
Created April 21, 2016 10:52
Show Gist options
  • Select an option

  • Save tomask-de/88a1bd9da30d48600d1129b4182e881b to your computer and use it in GitHub Desktop.

Select an option

Save tomask-de/88a1bd9da30d48600d1129b4182e881b to your computer and use it in GitHub Desktop.
react like
/** @jsx React.DOM */
var React = require('react');
var Ausgabe = React.createClass({
getInitialState: function() {
return {
gefaelltmir: false
};
},
handleClick: function(e) {
this.setState({
gefaelltmir: !this.state.gefaelltmir
});
},
render: function() {
var text = this.state.gefaelltmir ? "Schön, dass dir das gefällt." : "Klicke, wenn dir das gefällt.";
return (
<p onClick={this.handleClick}>{text}</p>
)
}
});
React.render(<Ausgabe />, document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment