Render-html-elements-to-the-dom

Render-html-elements-to-the-dom
0

#1

Tell us what’s happening:
I am getting following error message
The provided JSX element should render to the DOM node with id challenge-node.
the code syntax is correct.Kindly help

Your code so far


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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:


#2

Why are you using the following for the componentToRender argument?

JSX should be the first argument for the render function, because it is the component you want to render. The second argument is the DOM node you want to render JSX to, so you should be using document…getElementById(‘challenge-node’) in some way for the 2nd argument. My suggestion is to create a variable which references the div with id=‘challenge-node’ and pass that into the render function as the 2nd argument.


#3

It’s ok, just change the first argument of the ReactDOM.render function to JSX.