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 ...
随机推荐
- python使用tkinter做界面之颜色
python使用tkinter做界面之颜色 from tkinter import *colors = '''#FFB6C1 LightPink 浅粉红#FFC0CB Pink 粉红#DC ...
- iptables详解(14):iptables小结之常用套路
不知不觉,已经总结了13篇iptables文章,这些文章中有一些需要注意的地方. 此处,我们对前文中的一些注意点进行总结,我们可以理解为对"常用套路"的总结. 记住这些套路,能让我 ...
- Kubernetes 1.5.3 部署
> kubernetes 1.5.3, 配置文档 # 1 初始化环境 ## 1.1 环境: | 节 点 | I P ||--------|-------------||no ...
- redis在.net架构中的应用(1)--利用servicestack连接redis
引言:作为少有的.net架构下的大型网站,stackoverflow曾发表了一篇文章,介绍了其技术体系,原文链接http://highscalability.com/blog/2011/3/3/sta ...
- New Concept English three(20)
26w/m 36 In 1908 Lord Northcliffe offered a prize of £1000 to the first man who would fly across the ...
- SpringMVC札集(07)——JSON数据
自定义View系列教程00–推翻自己和过往,重学自定义View 自定义View系列教程01–常用工具介绍 自定义View系列教程02–onMeasure源码详尽分析 自定义View系列教程03–onL ...
- Lua基础---迭代器
官方的文档说: 迭代器(iterator)是一种对象,它能够用来遍历标准模板库容器中的部分或全部元素,每个迭代器对象代表容器中的确定的地址 在Lua中迭代器是一种支持指针类型的结构,它可以遍历集合的每 ...
- ECMAScript 6 基础入门
0. ECMAScript 与 JavaScript ECMAScript (ECMA 262)是 JavaScript 语言标准的名字,ECMAScript 是标准,JavaScript 是各厂商的 ...
- JSP学习(一)JSP基础语法
JSP基础语法 1.JSP模版元素 JSP页面中的HTML内容称之为JSP模版元素. JSP模版元素定义了网页的基本骨架,即定义了页面的结构和外观. <%@ page language=&quo ...
- BZOJ4292 PA2015 Równanie 【暴力水题】
BZOJ4292 PA2015 Równanie Description 对于一个正整数n,定义f(n)为它十进制下每一位数字的平方的和.现在给定三个正整数k,a,b,请求出满足a<=n< ...