Render State in the User Interface Another Way help me

Render State in the User Interface Another Way help me
0.0 0

#1

Tell us what’s happening:

Your code so far


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 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

Please note

Will render name local variable which is initialized as following

You are ignoring the name from the state

Fix is easy, instead of that constant “freeCodeCamp” for variable name, get the value from state.name
TIP: this refers to current object(component)

You can do it, it’s easy. Feel free to come back if you still need some more help about it. Happy coding.