Skip to content

Instantly share code, notes, and snippets.

@EECOLOR
Last active October 19, 2016 13:58
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 EECOLOR/98682832c73222eb53b306b51a3ded3f to your computer and use it in GitHub Desktop.
Save EECOLOR/98682832c73222eb53b306b51a3ded3f to your computer and use it in GitHub Desktop.
react without webpack
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Firebase component lifecycle</title>
</head>
<body>
<div id="container" />
<script src="../react/react.js"></script>
<script src="../react/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
<script type="text/babel">
const { Component } = React
class ExampleApplication extends Component {
render() {
const elapsed = Math.round(this.props.elapsed / 100)
const seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' )
const message = 'React has been successfully running for ' + seconds + ' seconds.'
return <p>{message}</p>
}
}
const start = new Date().getTime()
setInterval(() =>
ReactDOM.render(
<ExampleApplication elapsed={new Date().getTime() - start} />,
document.getElementById('container')
)
, 50);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment