Remove legacy React element warning

This commit is contained in:
Andrew Clark
2017-01-31 11:46:30 -08:00
parent 662e68deb1
commit de07331ab7
4 changed files with 0 additions and 22 deletions
-1
View File
@@ -41,7 +41,6 @@ src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js
src/addons/__tests__/ReactFragment-test.js
* should throw if a plain object is used as a child
* should throw if a plain object even if it is in an owner
* should throw if a plain object looks like an old element
* warns for numeric keys on objects as children
* should warn if passing null to createFragment
* should warn if passing an array to createFragment
@@ -59,17 +59,6 @@ describe('ReactFragment', () => {
);
});
it('should throw if a plain object looks like an old element', () => {
var oldEl = {_isReactElement: true, type: 'span', props: {}};
var container = document.createElement('div');
expect(() => ReactDOM.render(<div>{oldEl}</div>, container)).toThrowError(
'Objects are not valid as a React child (found: object with keys ' +
'{_isReactElement, type, props}). It looks like you\'re using an ' +
'element created by a different version of React. Make sure to use ' +
'only one copy of React.'
);
});
it('warns for numeric keys on objects as children', () => {
spyOn(console, 'error');
@@ -118,11 +118,6 @@ function throwOnInvalidObjectType(returnFiber : Fiber, newChild : Object) {
' If you meant to render a collection of children, use an array ' +
'instead or wrap the object using createFragment(object) from the ' +
'React add-ons.';
if (newChild._isReactElement) {
addendum =
' It looks like you\'re using an element created by a different ' +
'version of React. Make sure to use only one copy of React.';
}
const owner = ReactCurrentOwner.owner || returnFiber._debugOwner;
if (owner && typeof owner.tag === 'number') {
const name = getComponentName((owner : any));
-5
View File
@@ -167,11 +167,6 @@ function traverseAllChildrenImpl(
' If you meant to render a collection of children, use an array ' +
'instead or wrap the object using createFragment(object) from the ' +
'React add-ons.';
if (children._isReactElement) {
addendum =
' It looks like you\'re using an element created by a different ' +
'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {