Skip to content

onChange is called before state is changed #39

@sealightPT

Description

@sealightPT

When using valuelink on a dropdown with something like

this.linkRole = VLink.state(this, "role").onChange(this.onChangeRole);
<Dropdown selectedKey={valueLink.value} 
onChange={(event, option, index) => valueLink.set(option.key)} 

the onChange function is called before this.state.role is set, giving a value which is different from the one still in the state.
In some situations this is a problem because we know the value has changed but the state still has the old value - how can we wait for the state change to happen so that the state reflects the current drop down selection?

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