'This is hello word code from react.org copied and pasted but on my system I am having a syntax errro

ReactDOM.render (

  <h1>Hello, world!,
  document.getElementById('root')
);
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root"></div>
    <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 src="app.js" type="module"></script>
</body>
</html>

This is my first react code, which I copied from the react website directly. I can't figure out why it's giving me a syntax error. Can someone help me



Solution 1:[1]

You have not closed the h1 tag and copy this code in your index.js file

ReactDOM.render(
  <h1>Hello, world!</h1>,
  document.getElementById('root')
);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1