如何在React中做Ajax 請求
如何在React中做Ajax 請求
長風(fēng)秋雁
2019-04-12 11:06:58
TA貢獻(xiàn)1815條經(jīng)驗 獲得超10個贊
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 () {
舉報