Render State in the User Interface Another Way

Tell us what’s happening:

Your code so far


class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      name: 'freeCodeCamp'
    }
    const name = this.state.name;
  }
  render() {
    // change code below this line

    // change code above this line
    return (
      <div>
        { /* change code below this line */ }
        <h1>{ name }</h1>
        { /* change code above this line */ }
      </div>
    );
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/render-state-in-the-user-interface-another-way

Hi, I’m not sure what I’m missing in this challenge. <MyComponent /> should render the name in H1 element, but it doesn’t.

Any Idea?

Oops! Thanks. It’s worked.