如何在React中做Ajax 請求
如何在React中做Ajax 請求
慕田峪4524236
2018-07-10 14:14:51
TA貢獻1828條經(jīng)驗 獲得超6個贊
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 () {
舉報