React - Render HTML Elements to the DOM

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

const JSX = (
  <div>
    <h1>Hello World</h1>
    <p>Lets render this to the DOM</p>
  </div>
  ReactDOM.render(<JSX/>,getElementById())
);
// Change code below this line

Your browser information:

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

Challenge: React - Render HTML Elements to the DOM

Link to the challenge:

Hi saieed welcome to the freeCodeCamp forum! :partying_face:

I see some errors in the solution you provided, and I am going to give some hints so you can figure it out by yourself:

  • JSX is a constant that holds a JSX element, not a React component

  • You are missing something in the DOM API ...getElementById()

  • You are not providing an id as an argument to the DOM API

  • ReactDOM.render... needs to go outside the const JSX

I encourage to read the instructions carefully to figure out the correct syntax for the DOM API.

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