Skip to content

Inconsistent API: Setting the Select value programatically is possible only with strings (not with objects like options or asyncOptions) #409

@mik01aj

Description

@mik01aj

react-select is pretty nice when used on its own, but I find it hard to integrate with other components.

In particular, the only way to change the value programmatically it to update the value prop. But this has a serious problem: while options and asyncOptions can contain objects, value is only a string. The API is inconsistent here.

Think about this use case: I want an input for users to invite, and they should be shown with avatar. This limitation here means that if the user already added some friends to invite (they are objects with name and avatar url), after any programmatic change the avatars will disappear.

(For me, it means that I have to work it around by stopping using objects in options and save them somewhere else, and then get them in valueRenderer)

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