Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Invariant Violation: addComponentAsRefTo(...) #109

Closed
blvrd opened this issue Aug 13, 2016 · 1 comment
Closed

Uncaught Invariant Violation: addComponentAsRefTo(...) #109

blvrd opened this issue Aug 13, 2016 · 1 comment

Comments

@blvrd
Copy link

blvrd commented Aug 13, 2016

This issue may not belong here, but it's worth a try. I'm attempting to use react-map-gl inside a Rails project. I'm using this repo as a starting point.

After running npm install react-map-gl --save and including the code snippet from the readme, I get this error:

Uncaught Invariant Violation: 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).

After a ton of Googling, it seems that the problem is that two copies of React are being included on the page. However, I can't seem to find the duplicate dependency inside of react-map-gl. Any help would be much appreciated, and sorry if this is not a relevant issue for this project.

@ibgreen
Copy link
Contributor

ibgreen commented Aug 15, 2016

After running npm install react-map-gl --save and including the code snippet from the readme, I get this error: Uncaught Invariant Violation: addComponentAsRefTo(...): ...

@garrettqmartin8 react-map-gl's package.json lists react as a (peer dependency)[https://github.com/uber/react-map-gl/blob/master/package.json#L68] for this very reason (i.e. react-map-gl does not install its own version of react but uses a compatible version installed by the app), so I would first look elsewhere for the problem.

I'll close this out for now until there is more evidence this is react-map-gl related.

@ibgreen ibgreen closed this as completed Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants