Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.forceUpdate() #153

Open
molunhui opened this issue Nov 4, 2019 · 0 comments
Open

this.forceUpdate() #153

molunhui opened this issue Nov 4, 2019 · 0 comments

Comments

@molunhui
Copy link

molunhui commented Nov 4, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant