在我的应用程序中,我做了两个Ajax调用以获取一块数据。首先,我拨打电话获取ecommerceIntegrations
的列表。一旦我有了,我可以抓住他们各自的orders
。嵌套通量数据
我当前的代码看起来是这样的:
componentDidMount: function() {
EcommerceIntegrationStore.addChangeListener(this._onIntegrationStoreChange);
OrderStore.addChangeListener(this._onOrderStoreChange);
WebshipEcommerceIntegrationActionCreators.getEcommerceIntegrations();
},
_onIntegrationStoreChange: function() {
var ecommerceIntegrations = EcommerceIntegrationStore.getEcommerceIntegrations();
this.setState({ecommerceIntegrations: ecommerceIntegrations});
ecommerceIntegrations.forEach(function(integration) {
WebshipOrderActionCreators.getPendingOrdersOfIntegration(integration.id);
});
},
_onOrderStoreChange: function() {
this.setState({
pendingOrders: OrderStore.getAllPendingOrders(),
pendingOrdersByIntegration: OrderStore.getPendingOrdersByIntegration()
});
}
我试图按照Facebook的流量模式,我敢肯定,这并不遵循它。我看到一些关于Flux嵌套数据的其他SO帖子,但我仍然不明白。任何指针赞赏。这里