Skip to content

Instantly share code, notes, and snippets.

@calaca
Created May 17, 2017 01:30
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 calaca/fea280ad338c86959e4013f645d49b52 to your computer and use it in GitHub Desktop.
Save calaca/fea280ad338c86959e4013f645d49b52 to your computer and use it in GitHub Desktop.
Hello World in React with JSX
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@latest/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class Root extends React.Component {
render() {
const what = <h1>Hello World with JSX!</h1>;
return what;
}
}
const where = document.querySelector('#root');
ReactDOM.render(<Root />, where);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment