Write a React Component from Scratch error

For some reason I keep getting this error

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(){
    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 (X11; CrOS aarch64 11151.51.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.85 Safari/537.36.

Link to the challenge:

The problem is in the first line:

class MyComponent extends React.Component()

React.Component is not a function, so you should remove the parentheses () following it.

1 Like