React: Write a React Component from Scratch

Tell us what’s happening:
So I am having a real hard time figuring out why this code wont pass tests, any help would be greatly appreciated!

Your code so far


// change code below this line
class MyComponent extends React.Component {
constructor(props) {
    super(props);
}

render(){
   return 
       (
        <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/80.0.3987.132 Safari/537.36.

Challenge: Write a React Component from Scratch

Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/react/write-a-react-component-from-scratch

Good try. but whenever you are using return statements, make sure it’s on the line with whatever you are returning. At least part of it.

1 Like

Lol wow I reread everything like 50 times and that would have never occurred to me is there a reason for that or is just one of the quirks of the language thanks for helping me though.

If you are curious about the issue, have a read about Automatic Semicolon Insertion and why it’s important to be aware of it :+1:

1 Like

Oh thanks again that makes a lot of sense now!

This problem must be mis-written. There is no $#$ way to solve it!! I have been trying everything I could think of but nothing works!!!