I am working towards the FrontEnd libraries React topics - I have tried several attempts correct this code and I am still unable to find a solution, every attempt to change name to firstName, FirstName, Name , name, Nanji, is failing, please can someone assist, have already googled also, but cannot find correct way / solution to this:
I have tried line 12, with this.state.firstName, and FirstName, still not passing the test:, the 2 errors I get are:-
-
Failed:The state of
StatefulComponent
should be initialized with a propertyfirstName
set to a string. -
Failed:The property
firstName
in the state ofStatefulComponent
should render in theh1
element.
1 class StatefulComponent extends React.Component {
2 constructor(props) {
3 super(props);
4 // initialize state here
5 this.state = {
6 name: "Nanji"
7 }
8 }
9 render() {
10 return (
11 <div>
12 <h1>{this.state.name}</h1>
13 </div>
14 );
15 }
16 };
class StatefulComponent extends React.Component {
constructor(props) {
super(props);
// initialize state here
this.state = {
name: "Nanji"
}
}
render() {
return (
<div>
<h1>{this.state.name}</h1>
</div>
);
}
};