JavaScript
语言:
JaveScriptBabelCoffeeScript
确定
"use strict";
var App = React.createClass({
displayName: "App",
getInitialState: function getInitialState() {
return {
posts: []
};
},
componentDidMount: function componentDidMount() {
var th = this;
this.serverRequest = axios.get(this.props.source).then(function(result) {
th.setState({
posts: result.data
});
});
},
componentWillUnmount: function componentWillUnmount() {
this.serverRequest.abort();
},
render: function render() {
return React.createElement(
"div", {
className: "post-wrapper"
},
this.state.posts.map(function(post) {