Element type is invalid: expected a string (for built-in components) or a class/function

后端 未结 9 554
谎友^
谎友^ 2020-12-03 21:11
import React from \'react\';
import ReactDOM from \'react-dom\';
import Map from \'./components/map/container/map\';
import App from \'./App\';
import \'./index.css\         


        
相关标签:
9条回答
  • 2020-12-03 21:28

    As was sayed above, this issue with import. In my case it's was a CSSTransitionGroup import. After npm update the package 'react-transition-group' no longer contains CSSTransitionGroup, but it's contains different exports, like CSSTransition and TransitionGroup. So i just replace line:

    import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup'; 
    

    with

    import TransitionGroup from 'react-transition-group/TransitionGroup'; 
    
    0 讨论(0)
  • 2020-12-03 21:36

    I ran into the same problem in my react application. It's definitely your import statements as stated above. I changed:

    import {x} from '/x.js' to import x from '/x.js'

    and that got the job done

    0 讨论(0)
  • 2020-12-03 21:36

    In my case I solved it changing the components: They were written in functions declarations and I change them by classical Class declarations (class App extends React.Component instead of function App() )

    0 讨论(0)
提交回复
热议问题