如何在React中做Ajax 请求
2 回答
![?](http://img1.sycdn.imooc.com/54584d6100015f5802200220-100-100.jpg)
明月笑刀无情
TA贡献1828条经验 获得超4个赞
setTimeout(function () {
callback({username: 'xxx', age: 10});
}, 10);
}
var App = React.createClass({
getInitialState: function () {
return {data: {}};
},
handleSubmit: function (model) {
console.log(model);
//TODO
},
componentDidMount: function () {
loadCommentsFromServer('url', {}, function (data) {
this.setState({
data: data
});
}.bind(this));
},
render: function () {
- 2 回答
- 0 关注
- 522 浏览
添加回答
举报
0/150
提交
取消