question-mark
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.

Problem using react-select in Electron

See original GitHub issue

Hi,

I use this basic example in Electron

options = [
    { value: 'one', label: 'One' },
    { value: 'two', label: 'Two' }
  ];

  logChange(val) {
    console.log('Selected: ' + JSON.stringify(val));
    this.setState({
      value: val ? val.value : null
    });
  }

<ReactSelect
    name="form-field-name"
    options={this.options}
    onChange={this.logChange}
    value={this.state.value}
/>

and got the error

Uncaught Error: addComponentAsRefTo(…): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component’s render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

I found that the error appear when the value is set. If remove value then the display is correct but after select a value then the error appear again.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
davidmotecommented, Oct 12, 2017

Hello, I had a similar error when working on a package that uses react-select with redux-form. After fixing the multiple version of react issue @acac99 mentions, I was still having this issue on single select fields.

I was able to fix the issue by setting joinValues={true} on my Select Component, which caused a different hidden input to be generated, and the error went away.

0reactions
bladeycommented, May 27, 2020

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 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React styling - Overflow issues - Expo & Electron single workflow
I'm struggling with styling an element within react and being a complete newbie to the language would love some help from this awesome...
Read more >
Components - React Select
React -Select allows you to augment layout and functionality by replacing the default components with your own, using the components property. These components ......
Read more >
Error: Can't resolve 'react-select' with typescript-Reactjs
I found the issue having here. Issue is both @types/react-select and react-select added to the package.json. Namindu Sanchila 384. score:3.
Read more >
Building Electron desktop apps with React using Codemagic
Learn how to create an Electron desktop app with React and build it with Codemagic. ... A select menu will be used to...
Read more >
react select error handle Code Example
Answers related to “react select error handle” ... how to run electron and react using concurrently · how to run react app on...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found