如何在React中做Ajax 請(qǐng)求
2 回答

楊魅力
TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個(gè)贊
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 關(guān)注
- 617 瀏覽
添加回答
舉報(bào)
0/150
提交
取消