Legit question: What makes Svelte's 2-way binding better than its 2-way binding predecessors? Remember, part of the success of React is the rejection of 2-way binding and the bugs/confusion that came w/ it, favoring one-way data flow. The verbosity is a feature, not a bug.
Real quick! I was discussing this with @catalinmpit and thought I'd share! Same component, does the same thing. First image React the next one is Svelte. This was one of the big "aha!" moments for me coming from React. Take a look at the code in the next tweet!
Show this thread

8:35 PM · Oct 23, 2021

13
13
1
160
I won't deny the verbosity can get old. I'm also not insulting Svelte in any way. I genuinely want to understand how we've gone full circle on 2-way binding, and what makes it better in Svelte than previous 2-way binding frameworks.
6
0
0
42
I like the way it's done *and explained* in Vue: two way bindings are syntactic sugar for a pair of one way bindings. If you do want to deviate from the default impl, ex to use a store pattern, you easily can; otherwise why bother being verbose for no reason.
2
0
0
8
My question wasn’t about how it’s done, my question was what makes it safer now than it was then? It seems the best answer is that it’s more commonly scoped to a single component.
1
0
0
1
Replying to @kyleshevlin
Really like that your asking this question I am genuinely curious as well but have been afraid to ask because it sounds like I'm choosing one framework over the other
1
0
0
3
here
Svelte also has one way data flow under the hood, but uses binding and syntax sugar to simulate LOCAL two way data flow. its not that different. data propagation with stores vs context however are very different.
0
0
0
15
Replying to @kyleshevlin
React’s big win is that it’s **not reactive**, which it seems like every other framework misses.
1
0
0
3
legit question, How is it a win?
0
0
0
2
Replying to @kyleshevlin
Same question for mustache #each-style templating over a js filter() and map(). It’s just the same lessons that need to be learned over and over and over again.
3
1
0
28
I’m curious what your take is on map/reduce like operations in templating languages? I agree that, using JS directly is better, but I’ve never been able to express why, and what’s odd is I think conditional/pattern matching logic is better expressed via templating than JS.
2
0
0
0
Replying to @kyleshevlin
I just put together a short blog post talking about Svelte's approach to two-way binding, and how it avoids the traditional pitfalls associated with it. Hope it helps! imfeld.dev/writing/how_svelt…
3
1
0
21
Nice post! Sorry to be that guy but the parts that refer to Angular should really say AngularJS, as most of the stuff in that post doesn't apply to modern Angular 2+. Yes it's their fault for making the naming so confusing, but it's great if people don't add to the confusion!
2
1
0
1