score:3

Accepted answer

this.setstate call is not a synchronous process. calling setstate put it an update batch. your console.log statement should be called in callback argument of setstate:

this.setstate({country: c,},
         ()=>{ console.log(this.state.country)}
 )

see setstate doc


Related Query

More Query from same tag