I need help at " React: Write a React Component from Scratch "

What I need help with:
I can’t figure out how to complete this React: Write a React Component from Scratch.

My code so far


// change code below this line
class MyComponent extends React.Component {
constructor(props) {
  super(props);
  <div />
}
render() {
  return (
   ReactDOM.render(<null /> ,document.getElementById("challenge-node"))
  );
}
};

Challenge: Write a React Component from Scratch

Link to the challenge:

This one doesn’t work either

// change code below this line
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    <div> <h1> My First React Component!</h1>
    </div>
  }
  render() {
    return (
     ReactDOM.render(<null /> ,document.getElementById('challenge-node'))
    );
  }
};
1 Like

I found the solution

// change code below this line
class MyComponent extends React.Component {
constructor(props){
    super(props);
}

//render method
render() {
    return (
        <div>
            <h1>My First React Component!</h1>
        </div>
    );
}
};

//render the component to the DOM
ReactDOM.render(<MyComponent />, document.getElementById('challenge-node'));
1 Like