NervJS / nerv

A blazing fast React alternative, compatible with IE8 and React 16.
https://nerv.aotu.io
MIT License
5.43k stars 267 forks source link

this.forceUpdate() #153

Open molunhui opened 4 years ago

molunhui commented 4 years ago

项目中使用 this.forceUpdate()这个API来达到同步更新state的效果,结果发现会报错; image

代码示例:

onOptionCreate(option: Option) {
        this.state.options.push(option)
        this.state.optionsCount++
        this.state.filteredOptionsCount++

        this.forceUpdate()
        this.handleValueChange()
    }

去掉这个api改用正常的setState正常不会报错