如何在React中做Ajax 請求
2 回答

明月笑刀無情
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 關注
- 555 瀏覽
添加回答
舉報
0/150
提交
取消