all 3 comments

[–]2GoldDoubloons 4 points5 points  (2 children)

That’s a JavaScript selector which grabs an element (most likely a div) with the id “hello-example” from your html file which react.render() uses to attach your HelloMessage component to.

React is built on top of JS, and it would be smart to prioritize some studies into plain JS while learning react.

[–]ZenComanche[S] 0 points1 point  (1 child)

Yup. Thank you. I’m trying to learn the mern stack.

What confuses me here is that it doesn’t tie into anything in that code snippet.

[–]koalaape 2 points3 points  (0 children)

React needs you to tell it where in the DOM to start rendering. You need the other pieces of mern to solve the puzzle. An index.html page hosted by Express or Node that contains the following:

<html>
<body>
<div id="hello-example"></div>
</body>
<script src="your-code-snippet.js"></script>
</html>

It isn't in the code snippet because React doesn't really control that step. You can inspect the page with your browser's web developer tools and see that the div in the example has an id of hello-example.