fluxxor
fluxxor copied to clipboard
Allow Multiple StoreWatchMixins
I would like to be able to do something like:
var TimeMixin = {
mixins: [StoreWatchMixin("TimeStore")],
...
};
var List = React.createClass({
mixins: [..., StoreWatchMixin("ArticleStore"), TimeMixin, ...],
});
Unfortunately StoreWatchMixin only allows itself to be mixed in once per component. I would have to do something like:
var List = React.createClass({
mixins: [..., StoreWatchMixin("ArticleStore", "TimeStore"), TimeMixin, ...],
});
and not register the StoreWatchMixin in TimeMixin which seems less than ideal.
Good catch! This is definitely something I want to support, but an initial pass seems to indicate it may not be super straightforward because of the way React handles non-hook methods provided by multiple mixins (that is: it doesn't). I'll give this a closer look soon.
you could hook one of the lifecycles that get merged and dynamically create handlers that could then be enumerated?
Isn't the only non-hook method in StoreWatchMixin the private _setStateFromFlux?