写法1:<XXView xxxx={this.xxA.bind(this)} />写法2:constructor(props) {
super(props);
this.xxA= this.xxA.bind(this);
}写法3:xxA = ()=>{};
<XXView xxxx={this.xxA} />写法4:<XXView xxxx={()=>this.xxA} />1和2一样,3和4一样吧。那么实际中大家更倾向哪种写法?求教用箭头函数和用bind,有什么区别呢?哪个更好呢?
添加回答
举报
0/150
提交
取消
