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

原文地址:https://www.cnblogs.com/mengff/p/10940514.html