0

I am using Fluxxor and React Js and stuck with the following problem:

My React class is subscribed to several stores using mixins. My stores send this.emit("change") and I react to them in the function getStateFromFlux of the React class. But I want to know from which store I got a state change. How can I do this ?

Thanks !

Bill Lumbert
  • 4,633
  • 3
  • 20
  • 30

1 Answers1

0

Probably the best way is to create different listeners for different stores. So, you might have onXStoreChange, onYStoreChange, etc. But there's another trick you can use, if you choose to. When you call the emit function within your store, announcing a change, you can pass other args with it as well that will then be available to the listening component.

One thing you could pass is the store from which the change originated. Based on that, you could then know which store to ask for state info.

Hal Helms
  • 684
  • 3
  • 8