re: React Beginner Question Thread ⚛ VIEW POST

FULL DISCUSSION
 

Hi Dan,

I'm new to react wanted to ask if react set states asynchronously, why it is a need for declaring on the first place State = { name: ''} when it is assigned automatically when we use this.setState({name:'Dan'})

 

So that you set the initial value without adding any lifecycle methods.

code of conduct - report abuse