The merging is shallow, so this.setState({comments}) leaves this.state.posts intact, but completely replaces this.state.comments.
我的理解是,在多个异步请求都在调用this.setState()的时候,react会等到最后一个请求返回后,this.setState()才会更新视图,在此之前的this.setState()做的都是合并this.state这个对象的操作。这个理解有问题么?如果没问题的话,上面这段引用应该如何翻译?
呼如林
慕容708150
随时随地看视频慕课网APP
相关分类