Uncaught Error: Element type is invalid: expected a string (for built-in components)

前端 未结 2 1566
梦谈多话
梦谈多话 2021-01-23 11:04
I am getting this error. I have defined all components in index.js and I am using react-dom.

Webpacker itself is compiling with no err

2条回答
  •  不要未来只要你来
    2021-01-23 11:32

    This error is most likely caused because of your import statement. First this is weird import { App } from './components/CustomerSearch'; because here what i expect is that you have a file named CustomSearch.js but from your question it's AppComponent.js so i suggest you change it like this

    import App from './components/AppComponent';
    

    //here the name App doesn't matter as long as you're making a default export which you're doing.

提交回复
热议问题