Problem while rendering to the DOM node

Tell us what’s happening:
why is it failing the last test case: The provided JSX element should render to the DOM node with id challenge-node .

Your code so far


const JSX = (
 <div>
 <h1>Hello World</h1>
   <p>Lets render this to the DOM</p>
ReactDOM.render(JSX, document.getElementById("challenge-node"));


 </div>
);
// change code below this line

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Render HTML Elements to the DOM

Link to the challenge:

It s because you put ReactDOM.render(JSX, document.getElementById("challenge-node")); in between <div> </div>
You first declare your JSX before you can use it, in your case, you put the render method inside your JSX.

1 Like