TypeError: Cannot read property 'Component' of undefined
继续跟着阮一峰的教程走,下面写到PropTypes的getDefaultProps时,又出现了问题,基于上一个createClass的报错换成了Component写法
错误描述:


解决方法:引入react中的Component,将React.Component换成Component,原本的getDefaultProps换成defaultProps,并以使用属性的方式设置defaultProps
这趴我还是不知道为啥出的问题为啥这方法能解决 (°ー°〃)

笔记:getDefaultProps是一个方法,用来设置props的默认数据,通常情况下组件都会定义部分默认数据,这样调用组件时可以不用将每一个参数都设置一遍,
使用Component定义的组件,需要改为使用属性的方式来设置
TypeError: Cannot read property 'Component' of undefined的更多相关文章
- vue.common.js?e881:433 TypeError: Cannot read property 'nodeName' of undefined
我觉得吧,是这么个原因,就是响应式要找这个node改它的内容,没找着,就报错了. 用computed监控vuex的state属性,绑定到页面上,如果这个属性改了,因为响应式,那么就要更改页面,如果页面 ...
- vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined
vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined 借鉴了该大神的文 ...
- [Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined、vuejs路由使用的问题Error in render function
1.[Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined 注意,只要出现Error i ...
- Vue 组件封装发布到npm 报错 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined 原因是 没有导出 export default { name:& ...
- Uncaught TypeError: Cannot read property 'msie' of undefined
因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...
- easyui使用时出现这个Uncaught TypeError: Cannot read property 'combo' of undefined
easyui使用时出现这个Uncaught TypeError: Cannot read property 'nodeName' of undefined 最后检查发现是必须给select一个id,光 ...
- reactjs Uncaught TypeError: Cannot read property 'location' of undefined
reactjs Uncaught TypeError: Cannot read property 'location' of undefined reactjs 路由配置 怎么跳转 不成功 国内搜索引 ...
- index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined
使用 webpack 编译 Vue 项目时出现报错: index.js:13 Uncaught TypeError: Cannot read property 'split' of undefined ...
- Vue.js搭建路由报错 router.map is not a function,Cannot read property ‘component’ of undefined
错误: 解决办法: 2.0已经没有map了,使用npm install vue-router@0.7.13 命令兼容1.0版本vue 但是安装完之后会出现一个错误: Cannot read prope ...
随机推荐
- Ⅱ Finite Markov Decision Processes
Dictum: Is the true wisdom fortitude ambition. -- Napoleon 马尔可夫决策过程(Markov Decision Processes, MDPs ...
- 阿里云MNS官方PHP版SDK缺少message tag问题处理
最近在使用阿里云MNS官方PHP版SDK的过程中,发现发送到topic的消息,不能设置tag(其它语言版本SDK支持tag,如java,python),但在阿里云控制台页面发送是可以设置tag的. 因 ...
- 论文解读《Plug-and-Play Priors for Model Based Reconstruction》
这篇论文主要概述了model-baesd的方法在解决图像恢复的逆问题的很好的效果,降噪问题其实就是前向模型的H是一个恒等算子,将state-of-the-art的降噪算法(先验模型)和相对应的逆问题的 ...
- APP后台架构开发实践笔记
1 App后台入门 1.1 App后台的功能 (1)远程存储数据: (2)消息中转. 1.2 App后台架构 架构设计的流程 (1) 根据App的设计,梳理出App的业务流程: (2) 把每个业务流程 ...
- python中拿不到字典value值得问题解决
在python项目的练习中,根据字典的key值get不到value值,如图所示: 最后,将user = self.allUsers.get(cardNum)改成user = self.allUsers ...
- Spring Cloud 学习笔记 (一)-- Eureka 服务器
开局一张图,截取了本人学习资料中的一张图,很好地展示了Eureka的架构. Eureka服务器 管理服务的作用.细分为服务注册,服务发现. 所有的客户端在Eureka服务器上注册服务,再从Eureka ...
- 【转】Hello SDL
from:http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index.php Last Updated 6/11/19 So you learned the ...
- CodeForces 1182E Product Oriented Recurrence
题意 给定五个整数 \(n,f_1,f_2,f_3,c\),其中数列 \(f\) 满足以下递推式: \[f_x=c^{2x-6}f_{x-1}f_{x-2}f_{x-3} \] 求 \(f_n\). ...
- vue-cli中使用swiper
1.当前项目配置 cnpm install swiper vue-awesome-swiper --save 或指定版本下载 cnpm install swiper@5.4.5 vue-awesome ...
- STM32入门系列-STM32时钟系统,时钟初始化配置函数
在前面推文的介绍中,我们知道STM32系统复位后首先进入SystemInit函数进行时钟的设置,然后进入主函数main.那么我们就来看下SystemInit()函数到底做了哪些操作,首先打开我们前面使 ...