Last active
March 17, 2017 11:25
-
-
Save fourdollars/8a7c347d55a62e5ac4b78994147a0dde to your computer and use it in GitHub Desktop.
A complete react example from http://stackoverflow.com/questions/40230101/single-react-component-rendering-with-babel-standalone-with-only-index-html-and.
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
class MachineBox extends React.Component { | |
render(){ | |
return ( <div>Hello From React </div> ); | |
} | |
} | |
let target = document.getElementById('machine-box'); | |
ReactDOM.render( | |
<MachineBox />, target | |
) |
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> | |
<html> | |
<head> | |
<!-- Prevent from UTF-8 issue https://github.com/babel/babel/issues/340 --> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<!-- React --> | |
<script src="https://unpkg.com/react@15/dist/react.min.js"></script> | |
<!-- React DOM --> | |
<script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script> | |
<!-- babel core--> | |
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> | |
</head> | |
<body> | |
<div id="machine-box"></div> | |
<script type="text/babel" src="components.js" data-presets="es2015,react"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment