React - Write a React Component from Scratch

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

I have been trying to run below code but it gives me" Uncaught ReferenceError: ReactDom is not defined" as output in console is there anything wrong with my code if
there is something wrong with my code will you please correct it and send the correct solutiion please

Your code so far

// Change code below this line

class MyComponent extends React.Component{
  constructor(props) {
    super(props);
  }
  render(){
     <div>
      <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/114.0.0.0 Safari/537.36

Challenge: React - Write a React Component from Scratch

Link to the challenge:

Welcome to our community!

  • " Its render method should RETURN a div that contains an h1 tag with the text: My First React Component! in it." - You are missing the ‘return’ statement in your code

  • " Render this component to the DOM using ReactDOM.render() . There is a div with id='challenge-node' available for you to use."
    – the ‘div’ element should have the id set to the value of “challenge-node”
    – the text between h1 tags is missing one character at the end
    – the ReactDOM is not written properly.

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