11 ms·
Svelte is surprisingly easy to learn
- pavel_lishin 3y agoReact is "simple", too, in introductory tutorials where you build a todo-list app. Does Svelte stay simple as your constraints and needs become complex?
- internetter 3y agoIn my anecdotal experience — no. We started with Svelte and quickly migrated to solid (which has it's own handful of headaches but is much more manageable). Svelte was originally designed for little pieces of interactive content (in the nytimes), and it scaled like that for us back in 2021
- SkyMarshal 3y agoInteresting, Svelte and Solid seem to be the only two new compiler-based js frameworks. Everything else is virtual-DOM based. Solid is newer than Svelte with less of an ecosystem, so it’s interesting to hear that you found it more manageable. What made it more manageable?
- internetter 3y agoSo I guess it's worth first discussing ecosystem. Ecosystem is something I understand that people want, but we've generally avoided. Especially in react, there's a large worry about quality. Building something quickly that's taylor made for our business needs is much easier than parsing documentation, reading source code for QA, and then inevitably hitting an edge case. There are a couple instances where we did find ourselves missing an ecosystem (the first example that comes to mind is WYSIWYG editors), but for the most part we build it ourselves, and that's been fine. From what I recall of the Svelte ecosystem, it had a much more monolithic "this is how you do it" with the packages. By contrast, solid has a much larger focus on primitives — composing something you need from a set of modular tools. This also extends to our grievances with Svelte itself. I wish I could recall exact examples, but we transitioned 3 years ago and unfortunately I never recorded the exact issues. I do remember it distilled to a very similar problem. Things go great with the magic, until you hit some sort of problem that the framework authors did not anticipate, and you basically learn "you cannot do this". By contrast, solid gives you tons [0] of primitives. Almost every issue relating to state can be addressed with these primitives, and if not, you can easily compose your own (in fact, very few of the provided primitives are entangled with the core library. They themselves are built upon lower and lower level primitives). Also, with Svelte there were a considerable amount of design decisions I disagreed with. For instance, the context API uses strings instead of imports as identifiers, which breaks intelisense. I guess they want it to feel monolithic and integrated, but it's just frustrating. How do I extend this context system in Svelte? Everything really comes down to this fundamental decision between a "framework" and a "toolbox". Even the file structure reflects this. Solid, in some way, encourages small components — you can have multiple functions in a file, vs svelte where you can only have one. Each component in Svelte has significantly higher size overhead than solid, I suppose because you aren't supposed to have as many. In my opinion, the toolbox philosophy is much better equipped to handle the complexities of a large application. Sorry for such a long ramble without concrete examples. As I said, I really wish I wrote this out 3 years ago when we made the switch. As for Solid vs. React, there's plenty of discussions of this already. Aside from the much better performance, the solid model fixes almost all the footguns relating to state and rendering performance that react introduces, basically because it's closer to vanilla JavaScript (each function only runs "once") [0] https://www.solidjs.com/docs/latest/api https://www.solidjs.com/docs/latest/api e: I've checked back on this thread and I find myself agreeing with other people like gushogg-blake and spuz. Worth checking their comments out as well.
- SkyMarshal 3y agoThat is extremely helpful, even without many specific examples, thanks! It’s definitely something to be aware of at the start of a new project. If you anticipate the project will not get too large or complex, then Svelte is probably a good choice for the productivity and performance. But if it could grow over the years into something large and complex, then Solid’s primitives-focus and toolbox approach may be better. I wonder if Svelte5 will retain the framework philosophy or move toward the toolbox approach.
- internetter 3y ago> If you anticipate the project will not get too large or complex, then Svelte is probably a good choice for the productivity and performance. Yup. If I found myself trying to hack together something a weekend I'd be willing to use Svelte again! It's really quite productive at the beginning. Plenty of times when you just want simple reactivity without any other mental overhead.
- earthboundkid 3y agoVue has a compiler and a VDOM.
- pier25 3y agoCould you elaborate on the pros and cons? I've been using Svelte for about 3 years now and haven't found any big scaling headaches.
- DoesntMatter22 3y agoNot OP but I'll give my 2 cents. I much prefer Solid because it's explicit as far as which variables will be manipulated. However. I ended up usually using Svelte because it's so much less boilerplate than anything else.
- tiborsaas 3y agoOf course not. The closer you get to JavaScript, the bigger mess you are going to make. React's limitations is its greatest asset, it forces a team of engineers to stick to a common ground the must agree on: JSX, hooks, component life-cycle, etc.
- alternatex 3y agoReact is one of the few popular libraries well known for it's lack of opinion. Every React project is different and it's hard to consolidate developers on how things should be done. If you want common ground you'd go for Angular. React is the exact opposite of common ground.
- tiborsaas 3y agoIt does allow different ways of writing code and I agree that projects can be quite different architecture wise, but if I look at a component, I can be fairly certain that: - Its return value is a some kind of UI (I know about contexts) - Not using hooks, the variables in the JSX are side effect free - Using hooks will trigger a state update or you can prevent one - A re-rendered component re-renders the whole subtree I meant that these few assumptions are shared in a project by every developer touching the project and they must work with these in mind. Abusing these will result in a rejected PR. Can you still write bad react code? Absolutely, but at least I don't have to go back Adam and Eve to find what the hell is going on.
- anamexis 3y agoI have used Svelte, and I don't understand this take at all. The post is full of Svelte-specific constructs that you need to learn.
- kavii_suri 3y agoHey, totally agree with that, the article was an exaggeration to grab peoples attention and pull it towards the awesome framework that Svelte is. I don't think there's ever going to be an abstraction that's both useful and has nothing to learn. The point is that the amount of stuff in Svelte you need to know before you start building real stuff is very minimal.
- kylec 3y ago“You don’t learn Svelte! It’s just JavaScript!” proceeds to show examples with a very magic $ syntax
- uallo 3y agoIt may be unusual and has special semantics in Svelte, but it is JavaScript syntax after all. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- schwartzworld 3y agoThe only $ in that post is in console.log strings.
- jjnoakes 3y agoThat post describes "something followed by a colon is a label in certain contexts", so you need to extrapolate a tiny bit to realize that "$:" is a label, even if the post doesn't explicitly enumerate all possible labels.
- spicebox 3y agoIt’s not JavaScript, it looks like JavaScript but it works differently
- Zanfa 3y agoAren’t Svelte templates written in a completely custom template language that doesn’t even look like HTML/JS?
- dbrueck 3y agoNo, and that's one of the things that's really nice, at least for our team: we really want our web designers to own the HTML/CSS from start to finish. If you use something like React (i.e. where there is code that emits chunks of HTML elements), you sometimes either force the designer to learn React or the designer no longer owns the markup once it gets handed off to a dev. For us at least, that was a maintenance nightmare and hindered our ability to add new features or freshen up the layout. Svelte combines a component's HTML, Javascript, and styles into a .svelte file, so it all lives in one place, but each of those 3 things lives in their own section. The HTML looks very close to what it looks like when it was originally created by the designer, with a few key changes such as markers conditional blocks or loops and additional element attributes to set up data and event bindings. Explaining these to a web designer takes about 10 minutes and they are fine with it, especially if they've ever seen a templating language before. This setup also leads to one of two really good workflows between dev and design; we end up using both of them and choose one based on the specific scenario. In the first, the designer goes from visual design all the way to valid HTML/CSS, and then hands it off to a dev to "wire it up" (make it functional). In the second, a dev will rough in the HTML and make it functional but hideous looking, and then hand it off to the designer to de-uglify it. In both cases, the dev owns the behavior and the designer owns styling/layout/etc. from then on, and it's rare for there to be any conflicts. YMMV of course, but it's been fantastic for us. :)
- nightski 3y agoIt's just "JavaScript" in that it needs a translation layer and has a bunch of special syntax/semantics around reactive variables. Lol. I don't understand the cult following around Svelte. There's a lot of magic and complexity hiding in there. At the end of the day state management is not trivial and something has to handle it. React doesn't impose a specific state solution which is what I like about it. But while React isn't perfect, Svelte is not the next step imho.
- capableweb 3y ago> I don't understand the cult following around Svelte. There's a lot of magic and complexity hiding in there. What's new is old again :) People started doing React because they got tired of mixing languages for logic, structure and styles, why not do it all in JS? They got tired of that, so why not separate them? They got tired of manually doing bindings, so now that's hidden behind abstractions ("Hello 2000s templating magic"). I wonder what they'll get tired of next.
- jbman223 3y agoNext is writing code entirely. Whatever has the most robust documentation will be the next big thing, since AI agents will be writing the code for the programmers.
- teraflop 3y agoI'm concerned about the opposite possibility. All the effort will go into tweaking models and adjusting their training data until they generate acceptable output, and documentation for human consumption will be an afterthought.
- codaphiliac 3y agoWait till you fight a prompt to update the project in minor ways...
- capableweb 3y ago
- _steady 3y agoI hate the title of this. the quotes do so much heavy lifting. I was hoping for a post about removing Svelte and embracing the simplicity of vanilla javascript. Nothing against svelte.
- prabhu-yu 3y agoyes, I thought the same, expecting how the author giving reasons. At the end, I felt fooled by the author!
- ahipple 3y ago> It doesn't throw a bunch of alien syntax at you, expecting you to decipher it like an ancient scroll Sounds promising, but the first examples contrasts a React `useEffect` hook (a simple function call, into which you pass a callback and a dependency array) with <script> $: { console.log("Count Changed!", count) } </script> <!-- html --> Which prompted in me roughly these questions: - Is this actually just JavaScript? - Oh, is `$` a label? [I googled this to confirm it is] - I thought JavaScript didn't have a `goto` statement? [I googled this to confirm it doesn't] - How does this ever get invoked? [I still don't know the answer to this question -- MDN says that labels can only be used with `break` and `continue` statements] - Does it get invoked only when `count` changes? - If so, how? - If not, how do I specify the dependencies? It might 'just work', but it's also not 'just JavaScript'.
- Tade0 3y ago> How does this ever get invoked? Initially the same way it would without the $: { ... } wrapper - that is true both for Svelte and vanilla JavaScript. > Does it get invoked only when `count` changes? It's invoked whenever a named variable that is mentioned in the block is explicitly assigned to. That's the whole "magic" here really. It's "just" JS in the sense that there's no additional syntax introduced that would make it incompatible with any of the available JS parsers, so by extension TS parsers as well.
- ahipple 3y agoSure -- I did run that code in a JS REPL and saw that it invoked the block immediately, but that isn't necessarily what I want if I'm writing reactive code. I then tried typing `break $` and `continue $` and got SyntaxErrors for my trouble, confirming my hypothesis that this couldn't be plain JavaScript of the sort I was familiar with. > It's invoked whenever a named variable that is mentioned in the block is explicitly assigned to. This makes sense in the sense that it's a contract that I can accept and use, but it does imply the existence of a parsing pipeline & runtime of unknown (to me) complexity & capabilities -- exactly the sort of thing a prospective user of the framework would need to learn about sooner or later.
- consoomer 3y agoI sorta get it-- Svelte is simpler than React (at least at face value). What I don't get is why as an industry we are hung up on this need to do so much with JavaScript. In the end, Svelte is an incremental improvement over the thing that came before it. It will remain so until Svelte++ or whatever comes next. Great... but who cares? I wish we would spend more time thinking through new (or old) solutions to the problem we are solving. It's why HTMX gained some hype... but it's just the beginning.
- gochi 3y agoShifting the focus from JavaScript to HTML doesn't eradicate the problems. I enjoy HTMX, but I can't stand the current hype cycle regarding it being a revolutionary different take unlike those JS frameworks. You're just winding up doing the exact same thing that caused the React dilemma!
- consoomer 3y agoI don't think the answer is shifting focus to HTML. The answer seems to be in relinquishing some control back to the browser, but finding a way to make the experience smoother and add interactivity as needed without handicapping the browser's control in the process.
- recursivedoubts 3y agohtmx is a different take in that it moves the state into the hypermedia itself: https://htmx.org/essays/hateoas/ https://htmx.org/essays/hateoas/ that isn't without it's own problems, but it is very different than most JS libs today i expect the hype will die down soon, as the reality of there being no silver bullet sinks in
- consoomer 3y agoI'm not a fan of the htmx take, but it's refreshing to at least hear about other methods than "yet another react/angular/etc".
- markyc 3y agoRemix with react (just for the Jsx) seems like the sweet spot for me. 90% html and Js apis, with minimal magic to keep things component based and dynamic. Feels like the good ol days of PHP and ajax forms
- fullstackchris 3y agoi'd argue to an extent that _any_ programming language is not simple
- deleted 3y ago[deleted]
- pil0u 3y agoAs a hobbyist web dev using Rails, I am watching the JavaScript ecosystem from some distance - the mere JS experience I have is very vanilla or through StimulusJS/Hotwire. For the 3 years I have played with the web, I have been seduced to dive into a framework that is "fullstack" JavaScript to learn the language that is seemingly everywhere and "here to stay". I have seen dozens of articles like this one for all the major frameworks around - some not really maintained over time. I cannot find, in the JS ecosystem, the stability I know in the Rails ecosystem. I fall in a state where I search for objective arguments, hesitate, and end up not taking any decision. For those who know better, what is your current bet for a JavaScript (or TypeScript for that matter) framework that will last* the next 15 years? Is Svelte on the list? * maintained, with a rich and alive ecosystem
- Tade0 3y agoSvelte itself might not survive, but the idea of adding reactivity at compile time will remain, because it's just too attractive to abandon it. For one, in Svelte you're getting a legible stack trace - something that JS frameworks stopped delivering over a decade ago. To finally know which change triggered the rendering that errored out just by looking at the stack trace is a game changer.
- dorianmariefr 3y agoStack trace from React is pretty clear
- deleted 3y ago[deleted]
- iamsaitam 3y agoI'd say React (NextJS for fullstack) is that framework, it's already 10 years old.
- continuational 3y agoReact Hooks might as well be another framework than React Components, even if it's backwards compatible. If anything, it's proven unstable. My advice is - if you want something that will be stable for 15 years, look for something that has already been stable for 15 years.
- deleted 3y ago[deleted]
- meiraleal 3y agoThere is one thing that Svelte isn't is simple javascript. It is not even javascript, the files are named .svelte for a reason. Svelte is great but I won't be changing React for something so similar but without vdom. Lit.dev is where the real simplicity of JavaScript shines imo.
- alternatex 3y agoVirtual DOM offers nothing but slowness. If I can get the same things without it why would I need it. It's a solution to a problem compilers like Solid and Svelte don't have so it's so odd to see someone argue for it. Like complaining a about missing dependency injection in a functional language.
- tcfhgj 3y agoIsn't DI a core principle in functional programming?
- fullstackchris 3y agothe alternative is a global query / state management / whatever against the entire DOM tree - much less performant and exactly WHY the virtual dom was invented
- dbrueck 3y agoThe files are named '.svelte' because each one encapsulates the relevant Javascript, HTML, and styles. But why do you want the vdom exactly? Like, what does it give you? Seems like its presence is more an implementation detail of a framework than something a user of the framework would want, no?
- spuz 3y agoI am a big fan of Svelte - as a backend dev who is also responsible for writing frontend code, I saw a massive productivity jump when we moved our website from React to Svelte. But the premise of the article is just not true - you do need to fundamentally understand how Svelte manages the state of your pages. You need to understand how and when an update to the state in one location gets reflected elsewhere. Most of my time is spent trying to work out why state is or is not updating as I expect. Not helping this, it's not particularly well documented. For example, recently I had to learn about the onDestroy function which accepts as an argument a lambda. The docs [1] state that the lambda is run when the component is "unmounted", but offers no further information about exactly how or when this occurs. There is no official documentation on all the various lifecycle stages of a component and how or when each transition occurs. I find myself simply relying on a lot of trial and error or asking in the Discord forum. [1] https://svelte.dev/docs/svelte#ondestroy https://svelte.dev/docs/svelte#ondestroy
- sesm 3y agoI'm curious now, what disadvantages of React could outweight the entanglement of reactive state management and undocumented lifecycle. I could understand that you could have the same issues with state management if you were using MobX with React, but undocumented component lifecycle sounds crazy.
- adamnemecek 3y agoOut of the box, React provides much less than Svelte. Also the mental model of Svelte is one tenth of React. I was able to start building stuff after like 3 hours of reading Svelte tutorial. I have done the same with React several time and every time I left with “I kind of see how to do things but I’m unsure how to build larger things with this”.
- fullstackchris 3y agobut there are literally libraries on top of libraries to immediately provide in react what svelte might provide "out of the box". the best thing too is that these hooks are all open source - so you can either install a package directly, or pick and choose and install whatever hook you need. idk, i'm dying on the hill that react is unopinionated for a reason, i think it can be morphed and molded to so many use cases
- scelerat 3y agoThis weekend I went through the svelte/sveltekit tutorial, and I can't wait to use it in a project (several in mind in fact). I haven't felt this stoked about a front end library, its simplicity and apparent minimal painfulness, since Rails
- mehphp 3y agoI suspect that, like rails, it is simple at first but then becomes quite complex as the project grows or you want to do something that goes against the grain of the framework. Getting excited and then jumping all in on new frameworks has bitten me more than once.
- scelerat 3y agoI mean, that's true of just about every non-trivial framework ever
- DoesntMatter22 3y agoRails is an order of magnitude more complicated then Svelte/SvelteKit. There are so many conventions you have to know. Svelte/Kit isn't anything like that. It doesn't even come with an ORM.
- log101 3y agoThat simplicity, and we could say the same thing for React, makes it the worse candidate for developing apps. The building blocks are so small that it is almost impossible for juniors/mids to write well-written/well-structured code.
- lemper 3y agowhat would happen if I use svelte and jquery in the same page? who would win? the latest entry in the script declaration?
- jraph 3y agoThere's no clash: the "$" of Svelte is not a variable identifier like the one for jQuery. So it's all fine.
- azangru 3y ago"It's just plain JavaScript," says the article, and goes on to describe the special syntax — the dollar sign, the bindings, the templating language, something called writeable...
- thunderbong 3y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- pwdisswordfishc 3y ago"It's just plain JavaScript," say React advocates, and go on to describe the special rules — never invoke a hook under a conditional, assign keys to list items, remember to list all dependencies next to hook callbacks…
- qudat 3y agoWho says that? JSX alone would render that argument ridiculous.
- earthboundkid 3y agoIt is a traditional way of selling JSX/React.
- tayo42 3y agoIs the claim about simplicity true? What I want is Javascript helper library that's easy to jump back into. Every time I do it something in react, I feel like I need to go through the trouble of relearning it again(along with the build system) . I don't spend enough time writing js that whatever I learn really sticks after a while. Javascript on its own is just a language so I can just get going on a code base.
- dbrueck 3y ago> What I want is Javascript helper library that's easy to jump back into YMMV, but this is precisely why I've standardized on svelte both for work and hobby projects. There are times when I've come back to project that I haven't touched in over a year and it was really easy to get my bearings quickly because there wasn't all kinds of code noise to sift through.
- tail_exchange 3y agoPosts like these tend to disappoint me. Seems like the author is really excited about it and wants me to have some kind of revelation about how simple Svelte is, but the first example with the "$:" raised so many questions... What is that $? It's a label? How does it know that the variable changed value? Can I have more than one $ if I import another file that uses it? It also gave me a bunch of tiny snippets as examples, but that's never representative of a real codebase. How do you reuse these components? How do you deal with component lifecycle? It peaks my interest, but kills it with a bunch of magic and unanswered questions.
- jmull 3y agoI don’t think the article is a good intro to svelte or gives you much sense of using it. The title is positively incoherent. You’d be better off going through the main site’s tutorial. And since you’d presumably be interested in building full web apps as well, take a look at the sveltekit site and docs as well. The idea that there’s nothing to learn is nonsense. It’s not large and I think it’s straightforward, but there are various things to learn. IMO, the strength is that you write your HTML in HTML albeit with a simple templating extension, the reactive JS/TS is in the same context, and the reactivity model is simple/predictable and performs well (at least in my experience).
- kavii_suri 3y agoHey the author here, I totally agree with going through the official tutorial. That's what the article recommended tbh. The goal was to convince more people to give Svelte a try, as IMO, it's getting way less attention than it deserves. Anyway, thanks for the feedback, I'm quite new to blogging and writing in general. Will definately incorporate your suggestions in future work.
- woah 3y agoSo the framework which touts itself as “just JS” includes a templating pseudolang?
- porridgeraisin 3y agoRecently I've really liked Vue's composition API. The whole business of refs, emits being the only thing you need is really nice. Not too much to learn. JSX is there too - the old Vue API was simply a non starter for me.
- deleted 3y ago[deleted]
- gushogg-blake 3y agoHaving used Svelte on a large project, I found that it did scale reasonably well but that the usual problems did require effort and trade-offs. The two big ones for me were: - Managing file size and complexity in the component-per-file paradigm. Having all logic for a complex component in one file makes it big, e.g. 1,000 lines, but splitting into multiple files introduces a component boundary and consequent state passing/event handling boilerplate. - With tight coupling between a complex UI and complex domain objects/data structures, it becomes difficult to reason about data flow. There are multiple ways of binding the data to the UI -- props, stores, standard JS variables, and reactive statements -- but all come with trade-offs and none let you develop domain objects that are completely framework-agnostic without introducing repetitive boilerplate. For certain types of app I actually really like the DX of writing a UI-agnostic app and then layering Svelte on top of it with event handlers. It's repetitive -- you have to manually listen to events from the domain objects and update local variables with assignments -- but it's easy to reason about and seems to scale well. A good middle-ground might be making the app aware of the Svelte store contract, which is also very simple, but I haven't tried this and the store syntax comes with its own idiosyncrasies (you can't do $obj.store, for example, because only the $obj bit is interpreted as a reference to a store).
- woah 3y agoMaybe somebody will write a pre processor to let you break a component into several files lol
- jeremyjh 3y agoI really like the look of the composition API in Vue 3 though I have not used it yet, it gives me hope for addressing some of the issues you mention. I wonder does Svelte have anything comparable?
- gushogg-blake 3y agoFrom a quick look at the "What is Composition API?" question in the FAQ[1], I would say: - Reactivity API - yes, with $: labels - Lifecycle hooks - yes, similar to the ones mentioned - Dependency injection - not sure what it is exactly as I'm not familiar with Vue, but I don't think Svelte has a concept like this [1]: https://vuejs.org/guide/extras/composition-api-faq.html#what-is-composition-api https://vuejs.org/guide/extras/composition-api-faq.html#what...
- daft_pink 3y agoHonestly, is javascript actually simple? I find it to be a really wacky language that I now understand but would never say it has simplicity.
- fullstackchris 3y agoif anyone is wondering why i am perma supporting react and combating seemingly random react haters all throughout this thread, i have to say that i'm exhausted from sneaky anti-react posts popping up approximately every 2 weeks at this point theyre always exciting and fresh at first glance, but if you dig into any real engineering or large scale use cases, 99% of the arguments fall apart. reply to this comment if you have doubts, i'll share my decade+ experience with counter arguments if you stop and think for just a moment, a single moment, why react is the most popular frontend framework...
- tombolino 3y agoI am also tired of these hype articles. Tell us why react is most popular and best for real engineering
- sethammons 3y agoTL;DR: It feels like React interacts the reverse of how I think, but Svelte feels like it promises some of the straight-forwardness I used to know 25 years ago. As a backend person who last touched the frontend when jQuery was all the rage, I spent the last two weekends starting to get familiar with React and then Svelte. I really, really like what I've seen in Svelte so far. It makes sense. I can reason about what components talk to which other components and how, more easily than in React. After 8 hours of a React tutorial (which had several incompatibilities from the version in which the tutorial was written that I had to reason through), and after going through the Svelte tutorial for maybe half that at learn.svelte.dev, I came away feeling confident I can build a site in Svelte and not entirely sure what that would look like in React. I had to start looking at other projects in React to understand how I should organize my secure part of my site vs my public parts. It is clear in Svelte, for instance, where I can enable server side rendering on my more marketing / landing focused pages and how to group pages via the directory structure that require authentication.
- makingstuffs 3y ago> it’s all JavaScript I don’t get this narrative and Svelte isn’t the only community guilty of pushing it. Granted, the bulk of the logic you will write using the framework is ‘just JS’ but that is true of most frameworks. Most of the code you write in ReactJS is ‘just JS’ as I am sure is true for VueJS and god knows what else. However, Svelte, as with all frameworks, has a learning curve. Even the example pretty high up on the page is not ‘just JS’ nor is the JS used very standard, who on earth labels a scope with `$` in vanilla JS land? If I saw that while doing code review (in a vanilla codebase) I’d be instantly asking what the purpose is and for a more self explanatory label than a dollar sign, if a label was even required. Further down the page you get an example with a redux comparison using a hook called `writeable` which exposes a `subscribe` and `update` method. Neither of the three are standard JS. I realise this sounds like I’m bagging on Svelte, I’m not. I’m actually quite intrigued and want to try it out. I just cannot deal with all the false claims of ‘it’s just JS’, ‘you know it already’, ‘there is no learning curve’ etc. when there clearly is a learning curve and it clearly is not ‘just JS’. The framework is doing solid work and should be celebrated for what it is and not what it isn’t.
- dahwolf 3y agoMy bold prediction is that reactive frameworks will eventually be considered a mistake, as will its functional programming paradigms. It's all very computer-sciency and academic but it's simply not intuitive enough when used by a mediocre developer with no strong computer science background. They are leaky abstractions with lots of magic involved that get in your way. There's too many ways to do the same thing and it's way too easy to make a mess of things.
- graypegg 3y agoI honestly find functional programming paradigms to be simpler; coming from someone without any sort of comp sci background. Data goes in, UI comes out, seems pretty reasonable to me. But I will say, I do get being weirded out by magic. Hooks in React specifically, where they're being memoized so you get persistent values out of them, just feels to hacky to me still. Data and the old data from the last time this method was called goes in... and the UI is the combination of that? Class components were at least pretty straight forward, if a little verbose.
- rk06 3y ago>it's simply not intuitive enough when used by a mediocre developer with no strong computer science background If so, you should look into upgrading the developer into not-mediocore developer. When People are able to get upto speed on rust after a few months, How much trouble can react / vue be?
- franciscop 3y agoVery clickbaity title, this is definitely not "just Javascript you already know": <script> import counts from './store.ts'; import {onMount} from 'svelte'; </script> <button on:click={() => $counts.a += 1}> Increment A ({$counts.a}) </button> In that tiny snippet there's so many non-js things, like "where did that onMount go?", "why does $counts come from? is it from 'count'?", "how do events work?", "does the onclick update the value later on?", "can I do $counts.a++ instead? once? twice?" etc.
- eyelidlessness 3y agoThat’s not even all. - Why are these ESM imports allowed in a non-module script? - Even if $counts somehow references counts, how is either in scope in any part of button?
- cutler 3y agoUntil Svelte or any other JS framework can compete with React Native React will continue to reign.
- robbywashere_ 3y agoWhy is it that front end frameworks have so many fans, teams, logos, lifestyles and haircuts? Like for instance golang doesn’t give much for abstraction, so it doesn’t create rockstars out of its build system / dsl / etc ?
- mseepgood 3y agoGo has a logo and fans, and avoiding over-abstraction is a conscious lifestyle choice as well.
- LispSporks22 3y agoI’ve been trying to master HTMX/hypermedia ever since the GitHub accelerator bloggery a week or so ago. It kind of works for my smooth brain. I thought it was the new way to go after React, is it more likely Svelt is the way to go? Is it more like React or more like Angular? I hated both…