react报错:Cannot read property ‘setState‘ of undefined

错误如下:

代码如下:

原因是this已经不是当前组件的this了,可以在方法里加一个bind改变this的指向

猜你喜欢

转载自blog.csdn.net/joyvonlee/article/details/108870387