Cannot read property 'setState' of undefined
You're using function() in your Promise chain, this will change the scope for this. If you're using ES6 I suggest you use the arrow function to maintain the class scope. Example:
You're using
axios.get(APP_URL, { params: params})
.then(function(response) { // this resets the scope
this.setState({
videos:response
})
})
Try using arrow functions:
axios.get(APP_URL, { params: params})
.then((response) => {
this.setState({
videos:response
})
})
Cannot read property 'setState' of undefined的更多相关文章
- react报错 TypeError: Cannot read property 'setState' of undefined
代码如下: class test extends Component { constructor(props) { super(props); this.state = { liked: false ...
- easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined
1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问 ...
- vue.common.js?e881:433 TypeError: Cannot read property 'nodeName' of undefined
我觉得吧,是这么个原因,就是响应式要找这个node改它的内容,没找着,就报错了. 用computed监控vuex的state属性,绑定到页面上,如果这个属性改了,因为响应式,那么就要更改页面,如果页面 ...
- Uncaught TypeError: Cannot read property 'msie' of undefined
因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...
- SharePoint 2013 Error - TypeError: Unable to get property 'replace' of undefined or null reference
错误信息 TypeError: Unable to get property ‘replace’ of undefined or null referenceTypeError: Unable to ...
- jquery错误: Cannot read property ‘msie’ of undefined
背景 Web application, 引用了jquery 1.10.2和fancybox 1.3.4 现象 访问页面遭遇Cannot read property ‘msie’ of undefine ...
- easyui使用时出现这个Uncaught TypeError: Cannot read property 'combo' of undefined
easyui使用时出现这个Uncaught TypeError: Cannot read property 'nodeName' of undefined 最后检查发现是必须给select一个id,光 ...
- [转载][jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
参考 [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法 ---------------------------------------- ...
- [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法
最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property ‘msie’ of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...
随机推荐
- Java环境搭建---(基础)
首先下载eclipse开发工具,下载地址:http://www.eclipse.org/downloads/,界面如下: 选择eclipse juno(4.2)的版本进入界面 点击Downloads, ...
- Codeforces命令行工具
https://github.com/xalanq/cf-tool Codeforces Tool 是 Codeforces 的命令行界面的工具. 这玩意儿挺快.挺小.挺强大,还跨平台哦. 特点 提交 ...
- 十四、dbms_obfuscation_toolkit(用于加密和解密应用数据)
1.概述 作用:用于加密和解密应用数据,另外还可以生成密码检验和.通过加密输入数据,可以防止黑客或其他用户窃取私有数据;而通过结合使用加密和密码检验和,可以防止黑客破坏初加密的数据.当使用该包加密数据 ...
- Winform开发中另一种样式的OutLookBar工具条
很早的时候,曾经写了一篇随笔<WinForm界面开发之“OutLookBar”工具条>介绍了OutLookBar样式的工具条,得到很多同行的热烈反馈,我个人也比较喜欢这样的工具条布局,因此 ...
- qml自定义带文字的button tabbutton
https://blog.csdn.net/u014416260/article/details/54579480
- Recording︱有价值的各类AI、机器学习比赛心得、经验抄录
今年kaggle华人优胜团队很多,所以经验.心得不少,都是干货慢慢收集. 一.[干货]Kaggle 数据挖掘比赛经验分享 github:https://github.com/ChenglongChen ...
- [Python] 比较两个数组的元素的异同
通过set()获取两个数组的交/并/差集: print set(a) & set(b) # 交集, 等价于set(a).intersection(set(b)) print set(a) | ...
- IOS开发 清空数组正确方法
NSArray以及NSMutableArray 在Objc中的两种数组(不可变数组和可变数组), 在日常开发中,经常会遇到需要清空数组的情况,很多人下意识的会想到nil这个方法,这里是不提倡的.因为如 ...
- crm 02--->讲师页面及逻辑
要求: 讲师 批量初始化 考勤 录入成绩 批量初始化 考勤与批量初始化这两个功能都要放在课程记录表中CourseRecord # 批量初始化 # 将该班的所有学生,初始化带某一天,而不是将每个学生一个 ...
- 类的析构方法__del__
析构方法: 语法: class 类名: def __del__(self): ... 说明: 析构方法在对象被销毁时被自动调用 python建议不要在对象销毁时做任何事情,因为销毁的时间难以确定 cl ...