React wrong lesson text?

Tell us what’s happening:

Why must the correct solution have the class render a div with the ID that is supposed to be used with the ReactDOM.render later? It says nothing of having to use the challenge-node id in the div inside the class, only that it’s supposed to be a normal div

  **Your code so far**

// Change code below this line

class MyComponent extends React.Component{
constructor(props){
  super(props);
}
render(){
  return(
        <div id="challenge-node">
               <h1>My First React Component!</h1>
        </div>
  );
}
};
ReactDOM.render(<MyComponent/>, 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/89.0.4389.128 Safari/537.36.

Challenge: Write a React Component from Scratch

Link to the challenge:

the challenge instructions say

Render this component to the DOM using ReactDOM.render() . There is a div with id='challenge-node' available for you to use.

My point exactly. It says that the component is to be rendered in the div with the id of challenge-node using ReactDOM.render() - it does not say that inside the component that a div is to be used and have the same id (challenge-node). Yet I do not get the lesson approved unless I add the class of “challenge-node” to the div inside the component:

Its render method should return a div that contains an h1 tag with the text: My First React Component! in it.

The quote you embeded implies the div with id of challenge-node is available for use with the ReactDOM.render (for the componenent I am making withe the p-tag inside the div-tag to be injected inside), not that it should be added as a class to the div inside the component I am to render into the div with that id (Inception style).

weird, you should not have two elements with the same id

would you mind reporting a bug?

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

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