mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #5877 from spicyj/mount-class-error
Clarify error when passing class to render()
This commit is contained in:
@@ -382,11 +382,11 @@ var ReactMount = {
|
||||
'ReactDOM.render(): Invalid component element.%s',
|
||||
(
|
||||
typeof nextElement === 'string' ?
|
||||
' Instead of passing an element string, make sure to instantiate ' +
|
||||
'it by passing it to React.createElement.' :
|
||||
' Instead of passing a string like \'div\', pass ' +
|
||||
'React.createElement(\'div\') or <div />.' :
|
||||
typeof nextElement === 'function' ?
|
||||
' Instead of passing a component class, make sure to instantiate ' +
|
||||
'it by passing it to React.createElement.' :
|
||||
' Instead of passing a class like Foo, pass ' +
|
||||
'React.createElement(Foo) or <Foo />.' :
|
||||
// Check if it quacks like an element
|
||||
nextElement != null && nextElement.props !== undefined ?
|
||||
' This may be caused by unintentionally loading two independent ' +
|
||||
|
||||
@@ -54,9 +54,8 @@ describe('ReactMount', function() {
|
||||
expect(function() {
|
||||
ReactTestUtils.renderIntoDocument('div');
|
||||
}).toThrow(
|
||||
'ReactDOM.render(): Invalid component element. Instead of passing an ' +
|
||||
'element string, make sure to instantiate it by passing it to ' +
|
||||
'React.createElement.'
|
||||
'ReactDOM.render(): Invalid component element. Instead of passing a ' +
|
||||
'string like \'div\', pass React.createElement(\'div\') or <div />.'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -70,8 +69,7 @@ describe('ReactMount', function() {
|
||||
ReactTestUtils.renderIntoDocument(Component);
|
||||
}).toThrow(
|
||||
'ReactDOM.render(): Invalid component element. Instead of passing a ' +
|
||||
'component class, make sure to instantiate it by passing it to ' +
|
||||
'React.createElement.'
|
||||
'class like Foo, pass React.createElement(Foo) or <Foo />.'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user