Uncaught TypeError: Cannot read property 'state' of undefined

后端 未结 3 2086
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 14:04

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 
<         


        
3条回答
  •  独厮守ぢ
    2021-01-29 14:59

    You need to bind this.

    this.onSelect -> this.onSelect.bind(this)

    this.enhanceSection -> this.enhanceSection.bind(this)

提交回复
热议问题