Should I pass all the state in every change from store to component?

51 views Asked by At

I am new on React and Flux and I am making an app that will have an input (like the name or the title), and below a list of n things.

How should I handle the event listeners? I saw in the TODO example of flux (https://github.com/facebook/flux/blob/master/examples/flux-todomvc/) that they use one change listener and emit an event with all the store state on every change.

Is that ok for a real app? If not, what could I do?

1

There are 1 answers

0
Cymen On BEST ANSWER

Yes, that is okay for a real app. It is typical to emit whole objects from stores even if it just so happens one of the listeners only needs a subset of the data. The idea is to keep it simple and avoid having to change the store when what the listener needs changes.