flummox icon indicating copy to clipboard operation
flummox copied to clipboard

getStore (store lookup) by using the Store class or other mechanism

Open rafaelchiti opened this issue 9 years ago • 0 comments

I came across this 'requirement' while looking around my views to see who was using a particular store. Before when using singleton approach was easy to spot out my dependencies with my stores since I would have an explicit require on my views. Now with flummox I have strings to look up for the stores, it's very intuitive but a bit hard to find in the code when you have 10+ stores and many views around the app.

It would be kind of conceptually weird but would be nice maybe to say in the view that I want to get an store, something like

import ItemStore from '../stores/ItemStore';

fluxMixin([ItemStore])

This would leave a clear dependency declaration on the views and any other places of my app that use that store.

Again, seems a bit controversial to just require the file to get the 'class object' to do a look up, but leaving apart the implementation the issue itself feels like worth exploring when you have a big app and big team.

Thanks!

rafaelchiti avatar Mar 11 '15 20:03 rafaelchiti