Comment

Comment by xtrumanx

I don't think he read up too much on Flux since he implies Flux ditches unidirectional data flow. Flux is all about unidirectional data flow.

In the example involving the cart; he assumes the only way two sibling components can share state is by bloating parent components (by making them pass callbacks that they don't care about to their child components) or by breaking unidirectional data flow.

However, Flux (as described by Facebook) has a Store in which interested components can subscribe to change events. Your top level components will subscribe to the store and pass data to the child components. When a change occurs, only the top level component will get the new data and it will pass the data to its child components as usual. That doesn't break unidirectional data flow.

parent xtrumanx 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton