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