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

REF in react 15

Open jamesjjk opened this issue 8 years ago • 7 comments

Hi Excellent component, however after updating to react 15 there is an issue..

invariant.js?99c6:39 Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs.

I think because you give the component ref self it is causing the issue:

  1. The application has multiple react modules in the build.
  2. The ref attribute is not being used w/in the render method.

jamesjjk avatar May 13 '16 10:05 jamesjjk

Note that this component had a decorator with a context and stores.

jamesjjk avatar May 13 '16 10:05 jamesjjk

Hmm, do you know how to solve this? Haven't quite taken a look at actual react-15 issues

qimingweng avatar May 16 '16 16:05 qimingweng

@qimingweng sorry not immediately I will try and have a look tomorrow - but it may not be easy to resolve.

jamesjjk avatar May 16 '16 16:05 jamesjjk

I think it has to do with the fact that we're using render into subtree, which changes the "owner" vs the "parent" of a react element.

qimingweng avatar May 16 '16 16:05 qimingweng

@qimingweng Yep that would do it.

jamesjjk avatar May 16 '16 16:05 jamesjjk

Happy to take a PR sometime if you can figure out the details

qimingweng avatar May 16 '16 18:05 qimingweng

@qimingweng Hello i get error image Can you help me?