React Tutorial: TypeError: Cannot read property 'props' of undefined

后端 未结 4 1819
有刺的猬
有刺的猬 2020-12-29 04:31

I decided to learn React and started with the official tutorial. All is good until I get to this state of my code:

var CommentBox = React.createClass({
  ren         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 05:04

    A little late post/answer.

    Try to bind your function inside the constructor

    example:

    this.yourfunction = this.yourfunction.bind(this);
    

提交回复
热议问题