
1 WildCat 2016 年 3 月 9 日 不需要加吧, react native 用 babel |
2 123s OP @WildCat OnPress={ ()=> setState({name:'xx'})} .. 我这样写会报 setState 不是函数。 arrow function 应该不用 bind this 吧。 |
3 WildCat 2016 年 3 月 9 日 this.setState() 绝对不会是直接 setState |
5 yyfearth 2016 年 3 月 9 日 @123s 肯定要加 this 啊 arrow function 应该不用 bind this 的意思是 这函数本身没有 this 它的 this 是外面 function 的 this 但不等于说可以把 this 省略 除非你用 with statement 否则不存在可以省略 this 的情况 |
6 neoblackcap 2016 年 3 月 9 日 @yyfearth 应该说箭头函数的 this 跟包围它的的代码块里面的 this 是共享的吧。毕竟说没有 this 其他初学者可能会以为 this 变量就不能用了。 |