Tell us what’s happening:
Describe your issue in detail here.
Every time I run my answer I get this. * The state of StatefulComponent should be initialized with a property firstName set to a string.
Failed:The property firstName in the state of StatefulComponent should render in the h1 element.
what am I doing wrong? Your code so far
class StatefulComponent extends React.Component {
constructor(props) {
super(props);
// initialize state here
this.state = {
name : “Name”
}
}
render() {
return (
{this.state.name}
);
}
};
**Your browser information:**
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36</code>
**Challenge:** React - Create a Stateful Component
**Link to the challenge:**
https://www.freecodecamp.org/learn/front-end-development-libraries/react/create-a-stateful-component
Your example doesn’t help. The answer should be this.state = {
name : “Name”
} but I don’t know why I fail The state of StatefulComponent should be initialized with a property firstName set to a string? And I fail The property firstName in the state of StatefulComponent should render in the h1 element?