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

onChange is called before state is changed #39

Open
sealightPT opened this issue Jan 24, 2019 · 0 comments
Open

onChange is called before state is changed #39

sealightPT opened this issue Jan 24, 2019 · 0 comments

Comments

@sealightPT
Copy link

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?

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