React - Create a Stateful Component

I am so lost…

class StatefulComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      name: 'firstName'
    }
  }
  render() {
    return (
      <div>
        <h1>{this.state.firstName}</h1>
      </div>
    );
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

Challenge Information:

React - Create a Stateful Component

this should be the fistName and set value to for exml “Alex”

The state of StatefulComponent should be initialized with a property firstName set to a string.

2 Likes

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