學習reactjs的tutorial是看到function(){this.XX }.bind(this);不是很理解。補充: bind的作用我懂,在這里的寫法的目的不太了解$.ajax({ url: this.props.url, dataType: 'json', cache: false, success: function(data) { this.setState({data: data}); }.bind(this), error: function(xhr, status, err) { console.error(this.props.url, status, err.toString()); }.bind(this) });
回調函數的后面加個bind(this)的作用是什么
嗶嗶one
2018-10-20 14:10:23