29 ms·
I'm a primarily React-based developer, but have taken to using Svelte on side projects. Don't get me wrong, I still like React, but Svelte is phenomenally easy
by urthen 7y ago
I'm a primarily React-based developer, but have taken to using Svelte on side projects. Don't get me wrong, I still like React, but Svelte is phenomenally easy to get started and wrap your head around. I've started suggesting it instead of React to people looking to learn front-end JS.
- skinnymuch 7y agoHow long did it take to get semi comfy with Svelte (from recent React background)?
- spoiler 7y agoFor me, it didn't take long. I was initially confused by some "repurposed" syntax in svelte, and kinda felt negatively about it, but I grew to accept it, and even appreciate it (it's a hack, but on the elegant side). There's quite a bit of "repurposing" going on (probably so svelte can work with existing linters and other tooling), but you get used to it. Svelte has more often "magic" stuff, but the good thing is the magic is simple, and it easy to understand (especially since you can easily look at the compiled output, if you want to double check)
- cpfohl 7y agoI _left_ Svelte because it was headed in a direction I didn't believe in (all the repurposed syntax). But I gave it a try and had to apologize for disappearing. It is extremely well executed. One of the primary directives in Svelte is that it all has to be valid HTML so that the tooling can simply treat Svelte like HTML for syntax highlighting. Some of the repurposing is explicitly because of that directive.
- treggle 7y agoHow is it different and what’s so good about it?
- GoToRO 7y agoFrom what I know it's a compiler, so it check all the things at compile time and not waste time at run time.
- spoiler 7y agoThat's partially true. The other benefit is that there's no vDOM, the way things change is reactive (kinda like in react), but there's no such thing as a no-op change. if you set something to what it was, it would trigger a partial rerender so you have to check before setting. With react you get those checks for free (provided you comply to certain restrictions).
- rmilejczz 7y agoThe main draw is that Svelte apps have no dependencies at runtime, instead it compiles a pure vanilla js bundle that relies on existing web APIs to do updates. This is attractive to a lot of people, me included, but imo Svelte isn’t quite production ready yet (at least for complex apps). It’s great for small projects though and I highly recommend checking it out
- mellosouls 7y agoI read the main article which took some time to reach the conclusion a small footprint was the main point. So I googled, found the Svelte homepage, and I'm still none the wiser as to why it might be an easy intro to web development. Honestly, if Svelte is as easy as you suggest to get your head around, somebody needs to work on the presentation of that.
- treggle 7y agoAgreed. Lots of praise, no explanation.
- nailer 7y agoSvelte is: - smaller (it compiles your app, and doesn't include itself in the results) - faster (no virtual DOM, the data to elements are mapped at compile time) - simpler - `age = 30` no boring state management. You're right about the web page - I wanted them to drop 'Cybernetically enhanced web apps' for 'smaller faster simpler' - there was a GitHub issue for it: https://github.com/sveltejs/svelte/issues/3269 https://github.com/sveltejs/svelte/issues/3269
- spoiler 7y agoI feel like like saying svelte is an "easy intro to web development" is misleading. The svelte compiler "abuses" (I don't mean it in a bad way) existing technology so it doesn't have to create special tooling and works with existing tools. I think that's okay _only if_ you're aware of this as a developer. If I was hiring a JS dev, and someone _only_ had svelte on their CV, I'd be a bit reluctant to hire them, only because the svelte compiler hides a lot of JS warts (which I think people should be aware of).
- cpfohl 7y agoGenuine question: where does the svelte complier hide JS warts? I've used Svelte for some production tools and personally in a few projects. My experience thus far is that if you don't have at least a base-level understanding of JS you really can't use Svelte to its fullest. I can back up that intuition by having observed the svelte support channel on discord, where many of the questions really wind up being questions about javascript rather than Svelte.
- _eric 7y agoAre you using Svelte for SPAs? If so, what are you using for routing?
- felideon 7y agoI use Svelte with Sapper, which takes care of routing for me. From the FAQ: > Is there a router? > You can use any router lib you want. A lot of people use page.js. There's also navaid, which is very similar. If you prefer a declarative HTML approach, there's svero and svelte-routing. > If you need hash-based routing on the client side, check out svelte-spa-router, or abstract-state-router, a mature router for business software. > For an official solution, there's nothing that's simply a routing library. There is, however, the official Sapper framework, a Next.js-style application framework built on Svelte, which includes its own filesystem-based routing.
- nailer 7y agoI use Svero. Sapper is alpha and still in flux - I'll check out Sapper again once it's stable though.
- vcoelho 7y agoI felt the same way when I discovered Vue after a long time using React.