javascript - fluxxor add more than 1 set of actions to a flux instance -


i have set react application using fluxxor, trying use controller view gets multiple stores , actions, similar carousel example.

however in fluxxor example uses multiple stores 1 set of actions. wanted know how pass in multple actions.

var react = require('react/addons'),     fluxxor = require("fluxxor"),     authoractions = require("../actions/author-actions"),     authorstore = require("../stores/author-store"),     productactions = require("../actions/product-actions"),     productstore = require("../stores/product-store");  var stores = { productstore: new productstore(), authorstore: new authorstore()  }; // how combine actions here? var flux = new fluxxor.flux(stores, actions); 

fluxxor supports adding actions dynamically:

var flux = new fluxxor.flux(stores); flux.addactions(authoractions); flux.addactions(productactions); 

if namespaces don't conflict, can merge them underscore's extend:

var actions = _.extend({}, authoractions, productactions); 

or object.assign (or polyfill):

var actions = object.assign({}, authoractions, productactions); 

Popular posts from this blog