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 ...
随机推荐
- laravel中的validate验证的使用案例:
第一个是设置,第二个是直接调用.
- Web框架之Django-20-基于mysql数据库的连接
Web框架之Django-20-基于mysql数据库的连接 想要连接mysql首先需要安装pymysql这个驱动 然后在app的init文件中引入驱动 import pymysql pym ...
- 二、DBMS_JOB(用于安排和管理作业队列)
1.概述 作用:用于安排和管理作业队列,通过使用作业,可以使ORACLE数据库定期执行特定的任务注意:当使用DBMS_LOB管理作业时,必须确保设置了初始化参数job_queue_processes( ...
- 【转】OpenWRT开发自定义应用方法
[转]OpenWRT开发自定义应用方法 转自:http://blog.csdn.net/rudyn/article/details/38616783 OpenWRT编译成功完成后,所有的产品都会放在编 ...
- FusionCharts制作实时刷新图
转自:http://yklovejava-163-com.iteye.com/blog/1889949 下面介绍的是用FusionCharts制作实时刷新图的过程(FusionCharts确实太好用了 ...
- d3.js(v5.7)的比例尺以及坐标轴
直接上代码了,这里的一些函数用的是之前我自己封装的函数(包括attr的obj支持和节点数量和数据数量的自动匹配),若有不明白的,可以查看之前的博客: 页面的效果如下: 接下来继续添加坐标轴: 最终:
- 《Effective Java》读书笔记(二)之对于所有对象都通用的方法
第八条 在改写equals的时候请遵守通用约定 一般以下几种情况,不适宜覆盖equals方法 1.类的每个实例本质上都是唯一的,对于代表活动实体而不是值的类确实如此,例如Thread. 2.不关心类是 ...
- EasyAACEncoder海思/ARM平台优化G711、G726转AAC的CPU占用高问题
本文转自EasyDarwin开源团队成员Kim的博客:http://blog.csdn.net/jinlong0603/article/details/75645378 引言 目前EasyDarwin ...
- 【Hibernate实战】源码解析Hibernate参数绑定及PreparedStatement防SQL注入原理
本文采用mysql驱动是5.1.38版本. 本篇文章涉及内容比较多,单就Hibernate来讲就很大,再加上数据库驱动和数据库相关,非一篇文章或一篇专题就能说得完.本文从使用入手在[Spr ...
- java面试题大纲
跳槽时时刻刻都在发生,但是我建议大家跳槽之前,先想清楚为什么要跳槽.切不可跟风,看到同事一个个都走了,自己也盲目的开始面试起来(期间也没有准备充分),到底是因为技术原因(影响自己的发展,偏移自己规划的 ...