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

onSelect should be the event that returns the selected value. setSelected + onSelect together feels like an anti pattern #133

Open
ken-elsheezy opened this issue Dec 9, 2024 · 0 comments

Comments

@ken-elsheezy
Copy link

Why do we have to manage the state of the setSelected, won't it be better if you returned the selected value from the onSelect event.

i.e

<SelectList 
    onSelect={(selected) =>  console.log(selected)}
/>

Then I also noticed that the defaultOption triggers the setSelected which in turn triggers the onSelect. Confusing to the unsuspecting.

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