0
示例來自ReactJS代碼的「BIND」。我從來沒有使用綁定,並不確定它在ajax調用時如何在下面的代碼中執行。綁定在ajax調用上做什麼?
React.createClass({
componentWillMount: function() {
$.get(this.props.url, function (data) {
this.setState(data);
}.bind(this));
},
render: function() {
return <CommentList data={this.state.data} />
}
});