本文介绍了Uncaught TypeError:无法读取未定义的属性“状态”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
未捕获的类型错误:无法读取未定义的属性'状态'
out
class Accordion extends React.Component {
解决方案
您需要绑定这个
。
this.onSelect - > this.onSelect.bind(this)
this.enhanceSection - > this.enhanceSection.bind(this)
I am trying to change from React.createClass to React.Component, but I am getting below error.
Uncaught TypeError: Cannot read property 'state' of undefined
I googled for the error but an not able to figure it out
class Accordion extends React.Component {
解决方案
You need to bind this
.
this.onSelect -> this.onSelect.bind(this)
this.enhanceSection -> this.enhanceSection.bind(this)
这篇关于Uncaught TypeError:无法读取未定义的属性“状态”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!