React项目报错:Element type is invalid: expected a string可能的原因

React项目报错:Element type is invalid: expected a string 

起因:React使用Antd组件库,因为某些原因实在用不下去了,代码不变直接改成Tdesign组件库,于是就开始了解决无穷无尽的报错。。。

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, or you might have mixed up default and named imports. Check the render method of `Index`.

可能的原因:

  1. 组件名错误,比如MenuItem写成了Menu.item
  2. 还是组件名错误,比如antd里的Sider,Tdegsin里是Aside
posted @ 2023-12-01 23:30  我的五年  阅读(1515)  评论(0)    收藏  举报