Write a React Component from Scratch trouble

Tell us what’s happening:

Super expression must either be null or a function, not undefined

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>
}
};

Your browser information:

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

Link to the challenge:

Opening and closing() right after React.Component is unneeded, also you’re lacking return statement inside render().
Example:

class MyComponent extends React.Component(){
  constructor(props) {
    super(props);
  }
render(){
return(
    <div>
    <h1>My First React Component!</h1>
    </div>
)
}
};

Remove the () after React.Component
It’s a component not a function. Follow this.

class MyComponent extends React.Component{
  constructor(props) {
    super(props);
  }
render(){
    <div>
    <h1>My First React Component!</h1>
    </div>
}
};
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'));
1 Like