Solvedreact select Element ref was specified as a string (value0) but no owner was set. You may have multiple copies of React loaded. (details: https://fb.me/react-refs-must-have-owner)

Are you asking a question?

No, just a proposal

Are you reporting a bug or runtime error?

Yes. all error just after I upgrade react to version 16.

Element ref was specified as a string (value0) but no owner was set. You may have multiple copies of React loaded. (details: https://fb.me/react-refs-must-have-owner).

My code is here:

<Select
    name="foo"
    value={this.state.input.get('foo')}
    options={fooOptions}
    placeholder="foo"
    onChange={this.metaUpdateInput('foo')}
/>

and I review this repo, notice this line may occur this error:

ref={'value' + index}

in src/Select Line 929

React 16,
React-Select 1.0.0-rc.10

21 Answers

✔️Accepted Answer

I finally resolved this by making an edit in my webpack setup to specifically state where to use the required version of react. Something similar to the following, with an alteration to the node modules path, will hopefully help some people:

resolve: { alias: { 'react': path.resolve(__dirname, '../../node_modules', 'react') } }

Other Answers:

I have the same problem !!

@knoxjeffrey Thank you! Alias works for me. Noticed that to be a pattern for monorepo setup which involves multiple components referencing same libraries

Another possible solution is to use joinValues property.
If you just need to get value from the select and don't rely on (native) form submitting this will help.

<Select joinValues ... />

And if you don't use multiple values (multi) then it will not affect you at all.