Skip to content

Instantly share code, notes, and snippets.

@oreillyross
Created March 24, 2016 13:27
Show Gist options
  • Save oreillyross/353cb85370faacd115dc to your computer and use it in GitHub Desktop.
Save oreillyross/353cb85370faacd115dc to your computer and use it in GitHub Desktop.
React example from the website
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://fb.me/react-0.14.7.js"></script>
<script src="https://fb.me/react-dom-0.14.7.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
<div id="example"></div>
<script id="jsbin-javascript">
var HelloWorld = React.createClass({displayName: 'HelloWorld',
render: function() {
return (
React.createElement("p", null,
"Hello, ", React.createElement("input", {type: "text", placeholder: "Ross"}), "!" + ' ' +
"It is ", this.props.date.toTimeString()
)
);
}
});
setInterval(function() {
ReactDOM.render(
React.createElement(HelloWorld, {date: new Date()}),
document.getElementById('example')
);
}, 500);
</script>
<script id="jsbin-source-javascript" type="text/javascript">
var HelloWorld = React.createClass({
render: function() {
return (
<p>
Hello, <input type="text" placeholder="Ross" />!
It is {this.props.date.toTimeString()}
</p>
);
}
});
setInterval(function() {
ReactDOM.render(
<HelloWorld date={new Date()} />,
document.getElementById('example')
);
}, 500);</script></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment