React-select: valueKey / labelKey do not work as expected.

Created on 20 Dec 2017  路  6Comments  路  Source: JedWatson/react-select

Hi.

I have the same issue as https://github.com/JedWatson/react-select/issues/1807 (which is closed). I have an array of currencies:
const currencies = [{ code: "USD", name: "American Dollar", symbol: "$"}, ...]

and for my value and label keys I specify valueKey="code". But react-select craps out and won't render properly. Only works if my object has the value prop.

Thanks!

Most helpful comment

It looks like it only works if you set simpleValue={true}. But if you have multiselection enabled, the simpleValues get concatenated to a string instead of an array.

All 6 comments

Hi @pkuzhel
I don't see the problem and can't reproduce . Try to add also labelKey='name' and use latest react-select version.

I am also having this issue. labelKey works as expected; valueKey does not. Upgrading to the latest version of react-select (1.2.1) did not resolve the issue.

My select components work if I add a value property to the options, _even when valueKey has a value other than "value"_. It seems like react-select is ignoring the value of valueKey.

It looks like it only works if you set simpleValue={true}. But if you have multiselection enabled, the simpleValues get concatenated to a string instead of an array.

same issue

I also got issue with labelKey and valueKey. They don't work in v2.0.0 Beta
Currently, i get back to v1 to make it work

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest 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 / pull request 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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yrabinov picture yrabinov  路  3Comments

pashap picture pashap  路  3Comments

joshualimpj picture joshualimpj  路  3Comments

mjuopperi picture mjuopperi  路  3Comments

steida picture steida  路  3Comments