11 ms·
For all the use cases I deal with on a regular basis, Svelte looks more like vanilla HTML/JS than any equivalent React code. And the reason these things change
by RoboticWater 5y ago
For all the use cases I deal with on a regular basis, Svelte looks more like vanilla HTML/JS than any equivalent React code.
And the reason these things change is because that's what needed changing. One of the topline features of Svelte is that is has less boilerplate than React, and it achieves that quite handily. Unless you're criticizing particular constructs in Svelte that are unjustifiably different, I don't think unfamiliarity is that damning a criticism.
Maybe I'm just used to switching up languages on a regular basis, but the idea of having to learn different language constructs for loops and the like doesn't seem that herculean of a task.
- fron 5y ago> but the idea of having to learn different language constructs for loops and the like doesn't seem that herculean of a task. I agree. As long as you understand the basic concepts, it's only a matter of learning the syntax, which is really not as big of a deal as the person you replied to is making it out to be.
- cphoover 5y agoIt's not a herculean task... I agree, until you've learned 10+ (angular, vue, svelte, wordpress/php, jade templates, laravel, underscore/lodash, handlebars/mustache, hugo, etc..) of these "super simple templating languages"! And keep them all straight. I have no problem learning a new language if there is a compelling reason. But If it's just additional shit I have to remember for no clear reason... No thanks... We can have a debate on unidirectional data flow vs 2-way binding, how each framework manages state changes, how opinionated each framework is... How mature and vibrant each developer community is... etc. These are all another discussion though. My question is why must we reinvent the wheel again and again.
- bryans 5y agoYou need to stop insisting that a wheel has been reinvented with Svelte. It shares 95% of the same DNA as other frameworks, with multiple improvements over them. So with that in mind, what you're actually suggesting is that the existing offerings were somehow perfect, and we don't ever need to improve on anything again. That is an absurd notion, especially given that the other frameworks have gone through MASSIVE changes since launch -- sometimes even complete rewrites, because they acknowledged they got it wrong the first time.
- rawoke083600 5y ago100% agree !
- rawoke083600 5y ago>It's not a herculean task... I agree, until you've learned 10+ (angular, vue, svelte, wordpress/php, jade templates, laravel, underscore/lodash, handlebars/mustache, hugo, etc..) So you want all of these to be a universal-template-language - (D)HTML ?
- kall 5y agoOh but it‘s not just about the syntax, it‘s also about the semantics, scope rules etc. This is the reason I still like JSX best, because I have a fairly deep understanding of that stuff in javascript while vue templates still leave me scratching my head sometimes. But I can see the appeal either way.
- rawoke083600 5y ago100% - Common guys we are programmers in a field that is know for changing consistently (probably a lot faster than other careers). If you see learning new "syntax" for the basics (loops,conditionals etc) then you going to have problems down the road. Weather you use svelte, or some other new tech. If you really never want to learn another syntax.. learn LISP and be done with it. You are a programmer, you will need to learn new syntax a few times in your career. If some of the "biggest" complaints are "oh no I have to learn how to write for-loops again" - I guess svelte is doing the important stuff right. Wayyyy back in the day(ok not that long ago - 80/90's) when I was learning a new lang (Pascal,C, C++) I used to tell myself If I can get an working example of: 1) "user-input (readline,scanf etc)" 2) "printing input/output" 3) "calling functions/procedures" 4) "Do the loops + conditionals" 5) "file I/O" 6) "Memory schematics" You basically mastered the "building blocks/mrk(min-req-knowledge)" of the new lang and like maths you only need now practice or a good project. TL;DR If you are a professional-career-programmer, learning "new syntax (we used to call them keywords)" is a requirement.
- cphoover 5y agoWhat how can you say that??? <ul>{myItems.map({id, title}) => <li key={id}>{title}</li> }</ul> vs... svelte <ul>{#each myItems as item} <li>{item.title}</li> {/each}</ul> One is literally just javascript and html the other is an entirely different template language. You might say... JSX is not HTML... well it's very very similar... If you know HTML you JSX is very intuitive.
- pier25 5y agoObjectively, the Svelte example is cleaner and easier to read.
- spoils19 5y agoBy what metric are you measuring it objectively?
- pineconewarrior 5y agodensity.
- kosolam 5y agoSubjectively, I’d say. But since I agree that it’s cleaner and easier to read- I upvote you
- diegof79 5y agoThe issue is not only the syntax, but the semantics. What happens to the scope when you nest #each expressions? Does it work with iterables (like for..of), or it behaves like for..in? I don't use Svelte, and I don't know those differences by reading the code. To me the nice thing about JSX is that is straight forward with JS semantics: const a = <div prop={expression()} /> is a DSL for: const a = factory('div', {prop: expression()}) is only a DSL to create tree structures (React is another story, you can use JSX without React).
- epolanski 5y agoSaying it is objective but not mentioning the reason really makes your statement subjective.
- nnoitra 5y agoWhat boilerplate does React have? Do you mean Babel?
- cphoover 5y agoI know... This comment had no context... You don't have to even import React from 'react'; anymore
- kall 5y agouseMemo and useCallback do feel a little boilerplate-y. Something is slow, I wrap it in the thing, I let eslint fill the dependencies and there‘s no big downside to doing it all the time anyway. Feels like something I maybe don‘t need to be typing? useState is also something svelte eliminates, though I personally prefer to keep that explicit.