Render State in the User Interface Another Way - 4th test error

Render State in the User Interface Another Way - 4th test error
0

#1

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

    // 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_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

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


#2

you’ve hardcoded the ‘freeCodeCamp’ string rather than add a reference to it.
Here are the relevant instructions again from the challenge:

define a const called name and set it equal to the name value in the component’s state. Because you can write JavaScript directly in this part of the code, you don’t have to enclose this reference in curly braces.

So rather than type the string in, find a way to refer to it…


#3

As @hbar1st mentions, you need to reference 'freeCodeCamp" instead of just assigning ‘freeCodeCamp’ directly to the name variable. Do you see any other code referencing ‘freeCodeCamp’? Go back to the lesson right before this current lesson to see how you could reference the property in state named name.