r/programming • • Jun 09 '16

jQuery 3.0 Released!

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
1.1k Upvotes

354 comments sorted by

View all comments

Show parent comments

2

u/TheWix Jun 10 '16

Yep, I phrased that wrong. I guess it is more of a desire to have my assumptions proved incorrect by someone who actually works with it.

1

u/yooossshhii Jun 10 '16

I'll give it a shot. It helps a lot to have dove into React deep enough to get kinda lost in your components.

You wanted to make your app modular, but now you have 20 different components and they each have their own state to keep track of. Passing down props multiple levels is hard to keep track of, even worse when you decide to pass down a callback from a parent to get around the one way data flow. Now you have these side effects on your onclick that affect another component and have to keep track of this data flow anytime you want to make a change. As your app grows, so does the complexity.

These are the problems Flux seeks to solve. You have one source of truth, ideally an immutable source of truth which simplifies reasoning about it. You still might a complex data flow, but you have a set of directions that tell you how things happen (actions) and how your app should follow these directions (reducers). You've created a central place to handle incoming and outgoing data. You can easily check a component and figure out where data is coming from, even though your component doesn't actually care, it just presents it how you set it up to.

You've now decoupled the View entirely from how you Model your data and how that data is Controlled. As a result, it's easier to reason about everything and focus on other things.