React - Render HTML Elements to the DOM

Tell us what’s happening:
Describe your issue in detail here.
I got this error which says " The provided JSX element should render to the DOM node with id

challenge-node

."
Your code so far

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


// change code below this line
ReactDOM.render(React.createElement("JSX"),
               document.getElementById("challenge-node"));


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60

Challenge: React - Render HTML Elements to the DOM

Link to the challenge:

The component to render is just the name of the variable your storing the JSX in. You don’t need to use createElement here.

2 Likes

Thank you “bbsmooth” it works.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.