We're building a rather complex React + Reflux application and have a couple of stores that listen to some actions originating from some other component. Eg:
var FooStore = Reflux.createStore({
listenables: [FooActions, BarActions],
...
});
I don't find this approach ideal for a couple of reasons:
- When extending the BarActions you can unknowingly introduce an action with the same name as a Foo action, which will result in a regression bug
- It's not necessarily obvious which functions relate to the BarActions when reading the code in the FooStore
- If you are aware of a naming conflict, then you need to create overly verbose actions
How can I avoid these issues?
EDIT
My current approach to avoid these issues is to specifically state which actions the store is listening to over and above its main source of events:
var FooStore = Reflux.createStore({
listenables: [FooActions],
init: function() {
this.listenTo(BarActions.shoot, this.onShoot);
},
...
});