Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object

前端 未结 30 1661
孤城傲影
孤城傲影 2020-11-22 06:53

I am getting this error:

Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/funct

30条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 07:39

    Have you just modularized any of your React components? If yes, you will get this error if you forgot to specify module.exports, for example:

    non-modularized previously valid component/code:

    var YourReactComponent = React.createClass({
        render: function() { ...
    

    modularized component/code with module.exports:

    module.exports = React.createClass({
        render: function() { ...
    

提交回复
热议问题