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


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/

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…

2 Likes