Last active
October 19, 2016 13:58
-
-
Save EECOLOR/98682832c73222eb53b306b51a3ded3f to your computer and use it in GitHub Desktop.
react without webpack
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> | |
<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