I apologize if this is all answered somewhere in the docs, but I cannot figure it out:
1) If OptionType is defined as type OptionType = { [string]: any }, then how does react-select know what to use for the "label" when rendering the option? I don't see any prop for setting labelKey or similar. All of the examples online have options that look like { value: string | number, label: string }, but surely that's not a requirement, right? Otherwise presumably the OptionType would have those keys listed in its definition? 馃
2) What the heck is setValue? There is no explanation for this (perhaps the name is intended to be self-explanatory, but isn't the way you "set a value" done by just simply passing the value prop?).
Thanks!
menuOptions is a list of options built using props.options. In Select menuOptions.render[item].data is of type OptionType = { [string]: any } is an indexer property provided by flow, which states that indexer key type should be string with any type as value. The methods formatOptionLabel and formatGroupLabel returns labels for normal options list or a grouped option list respectively which are rendered using renderMenu. So as your options list can have various properties is why I guess no type checking using flow is added there.
setValue is a function which internally sets value for Select box on a Tab, Enter or Space key stroke.
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.
If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.
However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!