ReactでsetStateを呼び出した直後にその変数を参照しにいこうとすると更新が反映されていないケースがある。 例えば、componentDidMountメソッドでsetStateを呼び出して、stateの更新依頼をかけた後、すぐにcomponentDidMountメソッド内でそのstateを参照する場合、値が反映されていないケース。 class Hoge extends React.Component { constructor(props) { super(props); this.state = { foo:1 }; } componentDidMount(){ this.setState({ foo:2 }) // 下は1となる(本来は2になってほしい) console.log(this.state.foo) } render(){ return <span>{this.sta