Comparison of the Immutablity Helpers vs Flux pattern

I’ve been pondering how the ReactJs Immutability Helpers relate to the use of Flux. This question on Stack Overflow piqued my interest:

I commented:

Brandon, I’ve wondered about the relationship between the state helpers vs. if you were using a datastore object inside of the flux framework. I tend to just have the top level component listen to the store, and set it’s own state, which propagates down to it’s children via props. I don’t bother with the mutation helpers or even with copying the data, since react components update the stores via messages, rather than touching the props values.

Any advice?

My $.02 is don’t worry about this unless performance is a problem. Some wise professor told us ‘premature optimization is the root of all evil’ or some such. KISS

If you’re using Flux (or Reflux) a good guideline is “Components should not update their own state, they should only trigger Actions”. This sets you up to use the immutability helpers if necessary, and in my experience just makes it a lot easier to understand and test your system.