Super expression - React Component from Scratch

Tell us what’s happening:

Why isn’t this working? I checked all punctuation. When I run tests it says “Super expression must either be null or a function, not undefined”

Your code so far


// change code below this line
class MyComponent extends React.MyComponent {
  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/74.0.3729.131 Safari/537.36.

Link to the challenge:

There is an error in the declaration of your class. it should be ‘extends React.Component’, not ‘extends React.MyComponent’. When declaring a class you just use React.Component not the name of the component you’re declaring.

1 Like

What codemamba mentioned plus you have an unnecessary semi-colon after the constructor definition

should be

constructor(props) {
    super(props);
}

though it doesn’t ask to have a constructor here.

1 Like