Multiple Copies of React
See original GitHub issueHi @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:
- Created 8 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.