@samitouri / QOS-React-2 / commits / e984d2b7d2

Added note about multiple Reacts, since this error commonly implies that.

Jim committed Jul 22, 2015 at 18:48 UTC e984d2b7d23dd16ba849abfb38f4f82d5180936d
1 file changed +8 -10
src/renderers/shared/reconciler/ReactOwner.js
+8 -10
@@ -70,11 +70,10 @@ var ReactOwner = {
70 addComponentAsRefTo: function(component, ref, owner) {
71 invariant(
72 ReactOwner.isValidOwner(owner),
73 - 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
74 - 'usually means that you\'re trying to add a ref to a component that ' +
75 - 'doesn\'t have an owner (that is, was not created inside of another ' +
76 - 'component\'s `render` method). Try rendering this component inside of ' +
77 - 'a new top-level component which will hold the ref.'
73 + 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' +
74 + 'be adding a ref to a component that was not created inside a component\'s ' +
75 + '`render` method, or you have multiple copies of React loaded ' +
76 + '(details: https://fb.me/react-refs-must-have-owner).'
77 );
78 owner.attachRef(ref, component);
79 },
@@ -91,11 +90,10 @@ var ReactOwner = {
90 removeComponentAsRefFrom: function(component, ref, owner) {
91 invariant(
92 ReactOwner.isValidOwner(owner),
94 - 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
95 - 'usually means that you\'re trying to remove a ref from a component that ' +
96 - 'doesn\'t have an owner (that is, was not created inside of another ' +
97 - 'component\'s `render` method). Try rendering this component inside of ' +
98 - 'a new top-level component which will hold the ref.'
93 + 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' +
94 + 'be removing a ref to a component that was not created inside a component\'s ' +
95 + '`render` method, or you have multiple copies of React loaded ' +
96 + '(details: https://fb.me/react-refs-must-have-owner).'
97 );
98 // Check that `component` is still the current ref because we do not want to
99 // detach the ref if another component stole it.