Uncaught TypeError:无法读取未定义的属性“状态” [英] Uncaught TypeError: Cannot read property 'state' of undefined

查看:1037
本文介绍了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:无法读取未定义的属性“状态”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆