NervJS / nerv

A blazing fast React alternative, compatible with IE8 and React 16.

Home Page:https://nerv.aotu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

this.forceUpdate()

molunhui opened this issue · comments

项目中使用 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正常不会报错