今天在用react写后台出现了一个错误,找了好久才找到
Error: 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.
问题截图有说是因为没有使用 export default
进行导出,但是我的代码里面都是这样写的,最后发现是我的父级路由没有绑定component
导致的
最后将代码修改成绑定组件即可
正确代码
网友评论