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} />
}
});