react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

Error: Invariant Violation: addComponentAsRefTo

Open djbobbydrake opened this issue 11 years ago • 15 comments

Seeing this error in the latest 0.6.1:

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 

Anyone else having this issue?

djbobbydrake avatar Oct 24 '15 23:10 djbobbydrake

Same here.

yleclanche avatar Oct 25 '15 08:10 yleclanche

+1

NikitaKis avatar Oct 26 '15 08:10 NikitaKis

+1 https://gist.github.com/jimfb/4faa6cbfb1ef476bd105

samidarko avatar Oct 30 '15 09:10 samidarko

rm -rf node_modules && npm install solved the problem.

antoinerey avatar Oct 30 '15 12:10 antoinerey

Yup @antoinerey that worked for me. Closing this issue.

djbobbydrake avatar Nov 16 '15 01:11 djbobbydrake

Im having this problem too, reinstalling does not clear it

mgenev avatar Jan 21 '16 00:01 mgenev

Also experiencing the same issue.

davidwadge avatar Mar 23 '16 12:03 davidwadge

Hi, I'm using react 15.4.0 and react-modal 1.6.5, same thing here. Removing and installing it anew doesn't change anything...

What is causing this ? Isn't there any fix ?

GBarthos avatar Jan 31 '17 20:01 GBarthos

I'm having this issue when trying to run unit tests using mocha and enzyme. This issue makes it impossible to test components that use Modal.

jakubgs avatar Jun 09 '17 16:06 jakubgs

Hi all, which versions of react-modal and react are you using? Later today I can have a look on this. Can anyone write a reproducible example? codepen or other...

I'm reopening to gather more information.

diasbruno avatar Jun 09 '17 16:06 diasbruno

I'm running 15.4.0 of react and 1.7.3 or react-modal.

jakubgs avatar Jun 09 '17 16:06 jakubgs

@PonderingGrower can you try with an updated version of react-modal?

diasbruno avatar Jun 09 '17 17:06 diasbruno

I can, but it will take a while because I would need to pull it into our internal packaging system to be able to use it first, and I'm pretty much done for today as it's Friday evening.

I can get back to you with an attempt with a newest version on Monday. Thanks for taking a look at this, cheers!

jakubgs avatar Jun 09 '17 17:06 jakubgs

This issue must be fixed on current version v2+.

I'm closing this issue for clean up. Please, feel free to reopen this issue if needed. Thank you!

diasbruno avatar Jun 24 '17 17:06 diasbruno

This error with: 15.6.2 -react, 3.1.13 - react- modal

ophite avatar Feb 14 '18 16:02 ophite