Reflux store and actions flow logic: how to pass data from a store to another store

388 views Asked by At

Is it Ok for a store to create an action to another store?

My data in store A always changing frequently, and i want to pass the data in store A to store B every time that my data in store A gets an update.

So I've made a listener in store A, on data change that's calling an handle function which "fire" an Action dataChange(this.data) (in store A) with the current data and store B gets the new data by onDataChange(data) every time the my data changed in store A.

So it's working, but i want to know if this is how i supposed to work with the data flow or there is more elegant way to do it.

1

There are 1 answers

0
Hannes Johansson On BEST ANSWER

In the Reflux philosophy, stores listening to other stores is an acceptable and supported pattern, just use the listenTo method in store B and listen to store A.