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

3. react-dom.js:103 Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings

大概率是组件render中某个组件,import到的组件为空。原因是文件中没有组件,或者该组件没有被webpack编译

posted @ 2019-05-28 21:49  全玉  阅读(1571)  评论(0编辑  收藏  举报