Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't give only the value in props, it's only working with full object option

See original GitHub issue

For these options:

const options = [{ value: 1, label: "one" }, { value: 2, label: "Two" }]

In React Select v1.x.x, you could do this to select the first option:


Now in React Select v2, you have to do this:

  value={{ value: 1, label: "one" }}

I guess it’s a bug since it’s not documented anywhere (not mentionned in Upgrade Guide).

Non-working example:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:24
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

wayneblosscommented, Nov 14, 2018

Taking away the simple value as the default functionality was a bad decision.

I think someone needs to fork this library and put it back the way it was. Anyone willing to help with this?

drealldaycommented, Sep 24, 2018

I ended up going this route:

Props with full object options, and value is an array of values;

props = {
    options = [{value: x, label: y}, ...];
    value: [x, ...]

getValue returns the proper {value: x, label: y} objects for values;

const getValue = (opts, val) => {
  return opts.filter(o => val.includes(o.value));


  return (
      value={getValue(props.options, props.value)}
      style={{ width: '80%', margin: '30px 0' }}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot assign to read only property 'props' of #<Object> in ...
You cannot push to props this.props.nav.push({id: 'Applist', index: 2}); since component properties are read-only, as the error states.
Read more >
How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >
React Props Cheatsheet: 10 Patterns You Should Know
In this tutorial, we will be reviewing ten patterns you should use when working with props in React. We will not only touch...
Read more >
Accessing Data through Props with Known Key Names in ...
Through this guide, you will learn the different approaches to access the key-value pair of the props and state objects in a React...
Read more >
Updating Objects in State - React Docs
While mutating state can work in some cases, we don't recommend it. You should treat the state value you have access to in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found