📅  最后修改于: 2022-03-11 14:56:39.607000             🧑  作者: Mango
//our state needs some time to mutate, and since console.log(this.state.boardAddModalShow)
executes before the state mutates, you get the previous value as output. So you need
to write the console in the callback to the setState function
this.setState({ name: "myname" }, () => {
//callback
console.log(this.state.name) // myname
});