今天在用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
進行導出留量,但是我的代碼里面都是這樣寫的哟冬,最后發(fā)現是我的父級路由沒有綁定component
導致的
問題代碼
最后將代碼修改成綁定組件即可
正確代碼