Created
January 1, 2015 14:01
-
-
Save kkga/cd5bbac2c88e9a7fc216 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/winoqa
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://fb.me/react-0.12.0.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var HelloWorld = React.createClass({displayName: 'HelloWorld', | |
getInitialState: function() { | |
return { | |
counter: 0 | |
}; | |
}, | |
increment: function() { | |
this.setState({ counter: this.state.counter++ }); | |
}, | |
render: function() { | |
return React.createElement("div", null, | |
React.createElement("div", null, this.state.counter), | |
React.createElement("button", {onClick: this.increment}, "Increment!") | |
); | |
} | |
}); | |
React.render(new HelloWorld(), document.body); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//fb.me/react-0.12.0.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">var HelloWorld = React.createClass({ | |
getInitialState: function() { | |
return { | |
counter: 0 | |
}; | |
}, | |
increment: function() { | |
this.setState({ counter: this.state.counter++ }); | |
}, | |
render: function() { | |
return <div> | |
<div>{this.state.counter}</div> | |
<button onClick={this.increment}>Increment!</button> | |
</div>; | |
} | |
}); | |
React.render(new HelloWorld(), document.body);</script></body> | |
</html> |
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 HelloWorld = React.createClass({displayName: 'HelloWorld', | |
getInitialState: function() { | |
return { | |
counter: 0 | |
}; | |
}, | |
increment: function() { | |
this.setState({ counter: this.state.counter++ }); | |
}, | |
render: function() { | |
return React.createElement("div", null, | |
React.createElement("div", null, this.state.counter), | |
React.createElement("button", {onClick: this.increment}, "Increment!") | |
); | |
} | |
}); | |
React.render(new HelloWorld(), document.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment