-
Notifications
You must be signed in to change notification settings - Fork 351
Open
Description
Hi, Ninja,
I have watched the 2 series of your React toturials, and I have noticed that you like to use state directly in the class, instead of to put it in the constructor like the React documentation does.
class Foo extends Component{
state: {
name: "Shaun"
}
}
class Bar extends Component {
constructor(props){
super(props);
this.state= {
name: "Shaun"
}
}
}So, would you please explain it a little bit about why you prefer to use state like the above class Foo ? Thanks.
Metadata
Metadata
Assignees
Labels
No labels