- 報錯: Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
報這個錯的原因是,創建了react組件之后沒有使用export default對外暴露就在父組件中應用該,使用export default暴露出去就可以了哦!
2. 報錯: takes an object of state variables to update or a function which returns an object of state variables
報錯原因:在使用this.setState()方法是傳入錯誤的參數,實力方法setState()方法只接收,需要更新的狀態變量的對象,返回值是需更新狀態變量的對象的函數和null,如果你闖入的參數都不是object, function ,null那么久會報這個錯了
......持續更新中