Created
April 21, 2016 10:52
-
-
Save tomask-de/88a1bd9da30d48600d1129b4182e881b to your computer and use it in GitHub Desktop.
react like
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
| /** @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