Skip to content

Instantly share code, notes, and snippets.

@jfsiii
Last active August 29, 2015 14:02
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 jfsiii/313ff7cca60160bf305c to your computer and use it in GitHub Desktop.
Save jfsiii/313ff7cca60160bf305c to your computer and use it in GitHub Desktop.
Shareable React demo?
<!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>
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