寫法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一樣吧。那么實際中大家更傾向哪種寫法?求教用箭頭函數(shù)和用bind,有什么區(qū)別呢?哪個更好呢?
請教react native的寫法中,用bind和用箭頭函數(shù)哪個好?
慕慕森
2018-09-12 05:06:36