diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js index 42a1dcb45b..01d8539ca3 100644 --- a/src/core/ReactCompositeComponent.js +++ b/src/core/ReactCompositeComponent.js @@ -592,7 +592,12 @@ function mergeObjectsWithNoDuplicateKeys(one, two) { invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + - 'Tried to merge two objects with the same key: %s', + 'Tried to merge two objects with the same key: `%s`. ' + + 'This conflict may be due to a mixin; in particular, you may be using ' + + 'a mixin with its own getDefaultProps() or getInitialState(). This ' + + 'could result in both the mixin and base component (or another mixin) ' + + 'returning an object (either from getDefaultProps() or ' + + 'getInitialState()) with the same key.', key ); one[key] = value; diff --git a/src/core/__tests__/ReactCompositeComponent-test.js b/src/core/__tests__/ReactCompositeComponent-test.js index abfedc5dee..2aabc6d4ab 100644 --- a/src/core/__tests__/ReactCompositeComponent-test.js +++ b/src/core/__tests__/ReactCompositeComponent-test.js @@ -688,7 +688,12 @@ describe('ReactCompositeComponent', function() { instance = ReactTestUtils.renderIntoDocument(instance); }).toThrow( 'Invariant Violation: mergeObjectsWithNoDuplicateKeys(): ' + - 'Tried to merge two objects with the same key: x' + 'Tried to merge two objects with the same key: `x`. ' + + 'This conflict may be due to a mixin; in particular, you may be using ' + + 'a mixin with its own getDefaultProps() or getInitialState(). This ' + + 'could result in both the mixin and base component (or another mixin) ' + + 'returning an object (either from getDefaultProps() or ' + + 'getInitialState()) with the same key.' ); });