Skip to content

this.forceUpdate() #153

Open
Open
@molunhui

Description

@molunhui

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions