Skip to content

Instantly share code, notes, and snippets.

@Takeno
Created November 28, 2020 12:25
Show Gist options
  • Save Takeno/14ee2eb918448798eaead3b5b820b009 to your computer and use it in GitHub Desktop.
Save Takeno/14ee2eb918448798eaead3b5b820b009 to your computer and use it in GitHub Desktop.
Single-file-react
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<!-- We will put our React component inside this div. -->
<div id="root"></div>
<!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
<script>
const myApp = React.createElement(
"h1", {id: "h"}, "Hello, world!"
);
const container = document.getElementById("root");
ReactDOM.render(myApp, container);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment