4 ms·
Yo, React fanboy nitpicking missteps in the article here, so keep that in mind while reading this comment. > All browsers love plain JavaScript or Vanilla JavS
by yuchi 6y ago
Yo, React fanboy nitpicking missteps in the article here, so keep that in mind while reading this comment.
> All browsers love plain JavaScript or Vanilla JavScript because this highly efficient code can be parsed and executed faster than any other. Because it is plain JavaScript, your code changes the DOM directly. Svelte does not need a virtual DOM to simulate fast updates to the user.
Slow down. We all deploy plain JavaScript, no browser supports any other language.
Improving parsing and execution (at language level) bring very little improvement with Svelte over (for example) React. On the other hand, the absence of library functions to call may indeed flatten the call stack and give the perf boost promised by Svelte, but this requires Svelte to not being a library at all (more on that later).
This is also wording issue. It should have started with «the browser, mostly built around imperative structures, loves direct imperative changes to the DOM, and that’s how you MUST build the most efficient app interactions».
> At deployment, you get vanilla JS, that running in your browser. Fast and plain JavaScript
Again, wording!
> Apps developed are highly compatible. For example, if you develop a timer in Svelte, you can use the compiled version of your widget in any other framework. Why? Take a look at No. 1 it is VanillaJS.
(Point n. 1 being the previous quote)
This is not correct, or at least misleading. Every `.svelte` does indeed export an autonomous class that can be instantiated directly and mounted to a `target` DOM node, but that’s because Svelte is “embedded” inside the class.
In React you _can_ export a function which given a target DOM node mounts the app through `ReactDOM.render()` without the caller needing to have access to ReactDOM, it’s just not how you use components.
I have to admit that having that approach baked-in can be useful.
> The maintainers are free in their choice of the features they want to include in the framework. As Svelte itself is not in the compiled JavaScript output […]
I don’t remeber who said that but I once found this gem: «The most fantastic trick C has ever done is making everyone believe that it has no runtime».
That’s the same topic here, that’s because Svelte has a non-zero amount of shared code. Yes mostly utilities, but yet… it is shipped with yout code!
Listen, we all agree that they smartly moved a considerable amount of logic from the run-time to the build-time and we all rejoyce at this awesome competition, but this article is overlooking at how much is still happening behind the scene and how much code is still placed in the compiled output.
- - -
One final note: I know that Suspense is now a running joke in the JS world and I’m just making fun of myself here, but I really want to see how Vue and Svelte will compare to the ergonomics the new concurrency features when they’ll land in React.
- jpangs88 6y agoVue is also making something similar in both name and function https://vueschool.io/articles/vuejs-tutorials/suspense-new-feature-in-vue-3/ https://vueschool.io/articles/vuejs-tutorials/suspense-new-f... don't know about svelte...
- tomgp 6y agoI really like svelte (returning to react recently after 3 months of svelte felt like a real drag) but you’re right, this article is a mess - I really hope the confusion doesn’t put people of giving it a go.
- marcradziwill 6y agoYo yuchi, thanks for the comment ;):). I tried not to make an in-depth comparison between React and Svelte and wrote this article with a single view. I have a passion for web performance, so I like every single JS line that is not shipped. Nevertheless, I found your comments reasonable and constructive and edited most of the parts you mentioned. I'll deploy the updated version in the next days.
- yuchi 6y agoI was scared of being a little bit too snarky, happy to see you accepted the criticism. Nice to see you’ll address my comments. I think these are muddy waters. There’s a lot of polarization from people from different cultures, and a new player (such as Svelte) must gain its popularity without giving haters (as myself!) misconceptions to attack.
- marcradziwill 6y agoNo way! I like good comments that are not offending even if they are challenging ;). They can only make things better. In any case, continue like this :)!