Created
October 20, 2017 21:15
-
-
Save SaraVieira/4cd02f7c0242e8ae958bf46985ab8ff8 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
ReactDOM.render(<h1>Hello, world!</h1>, document.getElementById('root')) |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>The HTML5 Herald</title> | |
<meta name="description" content="The HTML5 Herald"> | |
<meta name="author" content="SitePoint"> | |
<script type="module" src="app.jsx"></script> | |
</head> | |
<body> | |
<div id="root"></div> | |
</body> | |
</html> |
One problem was that ReactDOM couldn't find the div because the script was running before the DOM inside of the body was created
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try the following:
app.jsx:
index.html: