clauderic/react-infinite-calendar

Error: addComponentAsRefTo multiple copies of React loaded

qron opened this issue · 0 comments

qron commented

Hello,

We use react >=15.3.2 as peerDep in our app and addComponentAsRefTo throws an error similar to #41

Uncaught Error: 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).
    at invariant (invariant.js?7313:42)
    at Object.addComponentAsRefTo (ReactOwner.js?4b81:66)
    at attachRef (ReactRef.js?435e:21)
    at Object.ReactRef.attachRefs (ReactRef.js?435e:40)
    at ReactDOMComponent.attachRefs (ReactReconciler.js?c56c:21)
    at CallbackQueue.notifyAll (CallbackQueue.js?7abf:74)
    at ReactReconcileTransaction.close (ReactReconcileTransaction.js?2d36:78)
    at ReactReconcileTransaction.closeAll (Transaction.js?91bc:207)
    at ReactReconcileTransaction.perform (Transaction.js?91bc:154)
    at ReactUpdatesFlushTransaction.perform (Transaction.js?91bc:141)
    at ReactUpdatesFlushTransaction.perform (ReactUpdates.js?be0d:87)
    at Object.flushBatchedUpdates (ReactUpdates.js?be0d:170)
    at ReactDefaultBatchingStrategyTransaction.closeAll (Transaction.js?91bc:207)
    at ReactDefaultBatchingStrategyTransaction.perform (Transaction.js?91bc:154)
    at Object.batchedUpdates (ReactDefaultBatchingStrategy.js?bdd7:60)
    at Object.batchedUpdates (ReactUpdates.js?be0d:95)
    at dispatchEvent (ReactEventListener.js?e4aa:145)
    at HTMLDocument.d (raven.js:416)

React version in devDependencies seems to cause the problem:

"react": "^15.3.0 || ^16.0.0-alpha"

"react": "^15.4.2",

I have just removed the devDependency in package.json running:

cd node_modules/react-infinite-calendar/ && npm uninstall react --saveDev

and it worked just as expected.

Is there a reason to keep react in devDependencies ? Should not it be removed ?