This is a simple piece of code. I am trying to get my first component to run and I followed the tutorial and this is their code for creating the component.
It works in that it does inject the first into the html document but the is missing.
For some reason it worked perfectly for the instructor in the video, as you can see here: https://youtu.be/G40iHC-h0c0?t=392
import React from "react";
import { render } from "react-dom";
class basicDiv extends React.Component {
render(){
return(
<div>
<h1>Hi my friend</h1>
</div>
);
}
}
render(<basicDiv/>, window.document.querySelector(".componentPlaceHolder"));
here is the index.html file:
<!doctype html>
<html>
<head>
</head>
<body>
<div class="componentPlaceHolder" style="border:1px solid black;min-height:100px;">
</div>
<script src="/app/bundle.js"></script>
</body>
</html>
.componentPlaceHolderthen this won't render anything.<div>in the right spot. Just no<h1>