Why is it not executing

Tell us what’s happening:
Describe your issue in detail here.

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

Challenge: Render State in the User Interface Another Way

Link to the challenge:

Hi @alimalim77 :wave:

It is executing, but there’s not much to display. If you console.log('name', name) inside the render function, you can see that it’s just an empty string. That empty string appears in the preview, so it looks like nothing has happened:

image

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.