Last active
August 29, 2015 14:02
-
-
Save jfsiii/313ff7cca60160bf305c to your computer and use it in GitHub Desktop.
Shareable React demo?
This file contains 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> | |
<body> | |
<script src="//fb.me/react-with-addons-0.10.0.js"></script> | |
<script src="//fb.me/JSXTransformer-0.10.0.js"></script> | |
<script type="text/jsx"> | |
/** @jsx React.DOM */ | |
function Hello(o) { | |
return <div>Hello, {o.name} @ {o.time}</div>; | |
} | |
</script> | |
<script> | |
var templates = { | |
hello: function Hello(o) { | |
// compiled above template at http://facebook.github.io/react/jsx-compiler.html | |
return React.DOM.div(null, "Hello, ", o.name, " @ ", o.time); | |
} | |
}; | |
</script> | |
<script src="index.js"></script> | |
</body> |
This file contains 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
function render(timestamp) { | |
requestAnimationFrame(render); | |
var o = { | |
name: "World", | |
time: timestamp | |
}; | |
React.renderComponent(templates.hello(o), document.body); | |
} | |
requestAnimationFrame(render); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment