diff --git a/src/renderers/dom/fiber/ReactDOMFiber.js b/src/renderers/dom/fiber/ReactDOMFiber.js
index 5718e45c18..cebe041481 100644
--- a/src/renderers/dom/fiber/ReactDOMFiber.js
+++ b/src/renderers/dom/fiber/ReactDOMFiber.js
@@ -378,23 +378,36 @@ var ReactDOM = {
// Top-level check occurs here instead of inside child reconciler because
// because requirements vary between renderers. E.g. React Art
// allows arrays.
- invariant(
- isValidElement(element),
- 'ReactDOM.render(): Invalid component element.%s',
- (
- typeof element === 'string' ?
- ' Instead of passing a string like \'div\', pass ' +
- 'React.createElement(\'div\') or
.' :
- typeof element === 'function' ?
- ' Instead of passing a class like Foo, pass ' +
- 'React.createElement(Foo) or .' :
+ if (!isValidElement(element)) {
+ if (typeof element === 'string') {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. Instead of ' +
+ 'passing a string like \'div\', pass ' +
+ 'React.createElement(\'div\') or .'
+ );
+ } else if (typeof element === 'function') {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. Instead of ' +
+ 'passing a class like Foo, pass React.createElement(Foo) ' +
+ 'or .'
+ );
+ } else if (element != null && typeof element.props !== 'undefined') {
// Check if it quacks like an element
- element != null && element.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- );
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. This may be ' +
+ 'caused by unintentionally loading two independent copies ' +
+ 'of React.'
+ );
+ } else {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element.'
+ );
+ }
+ }
}
if (__DEV__) {
diff --git a/src/renderers/dom/stack/client/ReactMount.js b/src/renderers/dom/stack/client/ReactMount.js
index 424cc4f678..cd3fe68503 100644
--- a/src/renderers/dom/stack/client/ReactMount.js
+++ b/src/renderers/dom/stack/client/ReactMount.js
@@ -434,23 +434,36 @@ var ReactMount = {
_renderSubtreeIntoContainer: function(parentComponent, nextElement, container, callback) {
validateCallback(callback, 'ReactDOM.render');
- invariant(
- React.isValidElement(nextElement),
- 'ReactDOM.render(): Invalid component element.%s',
- (
- typeof nextElement === 'string' ?
- ' Instead of passing a string like \'div\', pass ' +
- 'React.createElement(\'div\') or .' :
- typeof nextElement === 'function' ?
- ' Instead of passing a class like Foo, pass ' +
- 'React.createElement(Foo) or .' :
+ if (!React.isValidElement(nextElement)) {
+ if (typeof nextElement === 'string') {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. Instead of ' +
+ 'passing a string like \'div\', pass ' +
+ 'React.createElement(\'div\') or .'
+ );
+ } else if (typeof nextElement === 'function') {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. Instead of ' +
+ 'passing a class like Foo, pass React.createElement(Foo) ' +
+ 'or .'
+ );
+ } else if (nextElement != null && typeof nextElement.props !== 'undefined') {
// Check if it quacks like an element
- nextElement != null && nextElement.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- );
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element. This may be ' +
+ 'caused by unintentionally loading two independent copies ' +
+ 'of React.'
+ );
+ } else {
+ invariant(
+ false,
+ 'ReactDOM.render(): Invalid component element.'
+ );
+ }
+ }
warning(
!container || !container.tagName ||