React錯誤收集


1.  Uncaught 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

這個錯誤,最常見的問題是import組件出錯。例如,

import { com } from 't-com'  
//寫成了  
import com from 't-com'

或者

import com from 't-com'  
//寫成了  
import { com } from 't-com'

 2. JSON.parse()報錯 Unexpected token o in JSON at position 1

錯誤原因

1. 后端返回數據類型錯誤,前端解析報錯,查看接口返回數據來排除

2. 本地存儲中存在非法字符,使用隱身模式chrome窗口來排除

3. JSON.parse將一個非法的值或已經是Object的值二次parse


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM