I was having the same issue and realized that I was providing an Undefined React component in the JSX markup. The thing is that the react component to render was dynamically calculated and it ended up being undefined!
The error stated:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of
C
.,
The example producing this error:
var componentA = require('./components/A');_x000D_
var componentB = require('./components/B');_x000D_
_x000D_
const templates = {_x000D_
a_type: componentA,_x000D_
b_type: componentB_x000D_
}_x000D_
_x000D_
class C extends React.Component {_x000D_
constructor(props) {_x000D_
super(props);_x000D_
}_x000D_
_x000D_
// ..._x000D_
_x000D_
render() {_x000D_
//Let´s say that depending on the uiType coming in a data field you end up rendering a component A or B (as part of C)_x000D_
const ComponentTemplate = templates[this.props.data.uiType];_x000D_
return <ComponentTemplate></ComponentTemplate>_x000D_
}_x000D_
_x000D_
// ..._x000D_
}
_x000D_
The problem was that an invalid "uiType" was provided and therefore this was producing undefined as result:
templates['InvalidString']
_x000D_