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

前端 未结 30 1116
孤城傲影
孤城傲影 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:46

    In my case it ended up being the outer component imported like this:

    import React, { Component } from 'react';

    and then declared like:

    export default class MyOuterComponent extends Component {

    where an inner component imported the React bare:

    import React from 'react';

    and dotted into it for declaration:

    export default class MyInnerComponent extends ReactComponent {

提交回复
热议问题