this.setState
is asynchronous. It means that the time console logged could not be matched with the time state got updated
If you want to see exact value after state got changed, you have to do as below
this.setState({ 'updated': 'state'}, () => {
console.log(this.state.updated);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…