Write a React Component from Scratch Test Broken

Tell us what’s happening:

Keeps giving the error: “Super expression must either be null or a function, not undefined”

I’ve been writing React applications for almost a year now and have never encountered this error or had any issue with my components related to this. Also, at this point in the lessons, there is no mention of anything related to this error. It is the first time any mention whatsoever is made regarding the super() call or the constructor, which should have been a lesson in itself.

Something is wrong with the test. Here’s a couple of links to research the issue. Most seem to be regarding outdated versions of React, misspellings, or circular imports:
StackOverflow
github

Your code so far


// change code below this line
class MyComponent extends React.Component () {
  constructor(props){
    super(props)
    state = {
      foo: 'bar'
    }
  }
  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/71.0.3578.98 Safari/537.36.

Link to the challenge:

Remove the () after React.Component.

1 Like