Remove legacy React element warning
Andrew Clark committed
Jan 31, 2017 at 11:46 UTC
2a0fb5b4aaea06755268613a58eadb065a860d93
4 files changed
-22
scripts/fiber/tests-passing.txt
-1
@@ -41,7 +41,6 @@ src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js
41
src/addons/__tests__/ReactFragment-test.js
42
* should throw if a plain object is used as a child
43
* should throw if a plain object even if it is in an owner
44
-* should throw if a plain object looks like an old element
44
* warns for numeric keys on objects as children
45
* should warn if passing null to createFragment
46
* should warn if passing an array to createFragment
src/addons/__tests__/ReactFragment-test.js
-11
@@ -59,17 +59,6 @@ describe('ReactFragment', () => {
59
);
60
});
61
62
- it('should throw if a plain object looks like an old element', () => {
63
- var oldEl = {_isReactElement: true, type: 'span', props: {}};
64
- var container = document.createElement('div');
65
- expect(() => ReactDOM.render(<div>{oldEl}</div>, container)).toThrowError(
66
- 'Objects are not valid as a React child (found: object with keys ' +
67
- '{_isReactElement, type, props}). It looks like you\'re using an ' +
68
- 'element created by a different version of React. Make sure to use ' +
69
- 'only one copy of React.'
70
- );
71
- });
72
-
62
it('warns for numeric keys on objects as children', () => {
63
spyOn(console, 'error');
64
src/renderers/shared/fiber/ReactChildFiber.js
-5
@@ -118,11 +118,6 @@ function throwOnInvalidObjectType(returnFiber : Fiber, newChild : Object) {
118
' If you meant to render a collection of children, use an array ' +
119
'instead or wrap the object using createFragment(object) from the ' +
120
'React add-ons.';
121
- if (newChild._isReactElement) {
122
- addendum =
123
- ' It looks like you\'re using an element created by a different ' +
124
- 'version of React. Make sure to use only one copy of React.';
125
- }
121
const owner = ReactCurrentOwner.owner || returnFiber._debugOwner;
122
if (owner && typeof owner.tag === 'number') {
123
const name = getComponentName((owner : any));
src/shared/utils/traverseAllChildren.js
-5
@@ -167,11 +167,6 @@ function traverseAllChildrenImpl(
167
' If you meant to render a collection of children, use an array ' +
168
'instead or wrap the object using createFragment(object) from the ' +
169
'React add-ons.';
170
- if (children._isReactElement) {
171
- addendum =
172
- ' It looks like you\'re using an element created by a different ' +
173
- 'version of React. Make sure to use only one copy of React.';
174
- }
170
if (ReactCurrentOwner.current) {
171
var name = ReactCurrentOwner.current.getName();
172
if (name) {