Trouble with "Write a React Component from Scratch"

Tell us what’s happening:
I’ve tried with and without the </> part of MyComponent but it just keeps giving me errors n.render or c.render not being a function!

Your code so far


// change code below this line
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
  }
  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/72.0.3626.121 Safari/537.36.

That is not a valid return statement. You need to use the render method here and not a return statement. Look at the examples in the previous challenges you have completed.

The example given in the Create a React Component lesson shows

class Kitten extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <h1>Hi</h1>
    );
  }
}

So you’re close, but as @RandellDawson points out you need the render method, which you’ve missed.

If it helps to remind you which comes first, Render is alphabetically before Return :grinning: