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.

Multiple Copies of React

See original GitHub issue

Hi @JedWatson, great package and it works well in other Meteor apps I have. One of my meteor apps I’ve used webpack. The issue I’m now facing is:

Error: 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).

My app now and must use import React from 'react'; Is there a way to remove the error message I’m getting? I’m sure it’s because I’m pulling two versions of react.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
looshicommented, Jan 13, 2016

I ran into this issue using another react package alongside Meteor. I just deleted the extra react folder and it worked , here’s an explanation and solution that worked for me : https://medium.com/@dan_abramov/two-weird-tricks-that-fix-react-7cf9bbdef375#.pl4tej604

0reactions
JaakkoKarhucommented, Feb 8, 2017

I have the same problem when trying to fork React-Select as a git_submodule. Not using webpack on this project. No idea what to do, nothing seems to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solve having more than one copy of React in the same app
Checking the suggestions at React docs, I can confirm my app is using duplicate versions of React since the following code returns false:...
Read more >
Hooks + multiple instances of React · Issue #13991 - GitHub
I have a (hacky) workaround at the moment using npm-link-shared and a prestart npm script to essentially replace the one package's react ......
Read more >
How to correct having (at least) two instances of React installed
I have a project that I started with Create-React-App that was working wonderfully. Today my goal was to build out a component for...
Read more >
Invalid hook call - How to resolve multiple versions of React ...
I noticed that whenever I link each individually, the former unlinks. So by doing npm link ./path-to-app/node_modules/react ./path-to-app/ ...
Read more >
Invalid Hook Call Warning - React
In general, React supports using multiple independent copies on one page (for example, if an app and a third-party widget both use it)....
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