Skip to content

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

@ken-elsheezy

Description

@ken-elsheezy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions