Open molunhui opened 4 years ago
项目中使用 this.forceUpdate()这个API来达到同步更新state的效果,结果发现会报错;
代码示例:
onOptionCreate(option: Option) { this.state.options.push(option) this.state.optionsCount++ this.state.filteredOptionsCount++ this.forceUpdate() this.handleValueChange() }
去掉这个api改用正常的setState正常不会报错
项目中使用 this.forceUpdate()这个API来达到同步更新state的效果,结果发现会报错;
代码示例:
去掉这个api改用正常的setState正常不会报错