malloryerik

malloryerik

Svelte - what do you think about it?

Any thoughts on Svelte?

Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser , Svelte shifts that work into a compile step that happens when you build your app.

Instead of using techniques like virtual DOM diffing, Svelte writes code that surgically updates the DOM when the state of your app changes.

54 3555 17

Most Liked

dorgan

dorgan

I’ve used it, both svelte and sapper.
My opinions:


The good:
It’s reactivity works well, you get used to the special syntax bits very quickly, so don’t be afraid of it.

Overall it’s quite fast, both for those synthetic benchmarks(look at how I render a million dom nodes with my library instead of using canvas!) and for real use cases.

It comes with a state management solution(stores), animations and transitions out of the box.

Sapper makes sense, and is a fast and quite batteries included solution for both SPA and SSR. You can get an decent SPA with SSR website up and running in a couple minutes. Handling cookies can be a bit confusing at first, though.

It’s relatively easy to integrate with other js libraries, I wrote some bindings for prosemirror while learning it and it worked quite fine.


The bad:
It’s output doesn’t work in legacy edge nor older browsers(try to see any NYT article featuring Rich Harris visualisations on an older browser, it just doesn’t load).

There’s no way to access child nodes. If you want to wrap individual childs(say, receive a list of components and wrap each of them in some other component, like you would do with special list items), you can’t.
For example, I created a ListStream component that imitates discourse’s cloaking behaviour(unmount out of screen dom nodes), and I had to pass the list items as a prop for the ListStream to wrap them, which is a horrible workaround in my opinion.
There was a discussion about that in the svelte’s discord when this article was published and there was no solution. Responses from contributors were too defensive from my pov(part of that was valid: the medium article wasn’t particularly good, but it had valid criticism on svelte’s lack of reflection) and ranged from “yes you can” or “why would you do that”, but no examples of how is it possible was given, and it was proven to be impossible.

That discussion and Rich’s responses in his Why I don’t use web components article, where people addressed his criticisms and he replied with snarky comments or refused to continue the discussion left me with a bitter taste. I would like to see more transparency and discussions about svelte’s weak points too, so they can be addressed properly.

Typescript support was bad a couple months ago, though it is supposed to improve sometime in the future.


Overall it’s very good, and it’s worth trying out.

I’m not currently using it though, since I want to render as much html as possible with Elixir Phoenix and custom elements are more suitable for that usecase.

fzngagan

fzngagan

We’re at an opposite end of the spectrum working with Ember.js. Kinda maximalists :wink:

dimitarvp

dimitarvp

Sadly never worked with it – just heard a lot of good feedback from JS devs.

It’s kind of like Rust for JS, meaning that it compiles to “native” JS without you having to carry the framework with you. Which I quite like.

Where Next?

Popular Frontend topics Top

AstonJ
Here’s a pretty good list of them: https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS What’s your favou...
23 1591 8
New
kokolegorille
Hello everyone, Does anybody uses Web Components in 2020? It’s quite old, but recently it seems to have some kind of revival. I have be...
15 690 4
New
MikhailPertsev
Finally, I am going to enhance my css skills! I have always somehow ignored this, but now I finally decided to understand animations, tr...
15 691 6
New
finner
Some resources for Spring Home of Spring Spring Initializr Head First Spring with Reactor
2 1213 0
New
AstonJ
Wondering if anyone has any thoughts on choosing between these two languages for WebAssembly? I definitely want to explore wasm, and rea...
16 2735 12
New
mafinar
Just like I did one on Tailwind some time ago, I am going to play with AlpineJS the next few days. It’s a nice little JS framework that ...
30 2541 11
New
XSukhpreet
My Favorite tool is figma, It helps a lot in designing .
34 1581 13
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
4 3745 1
New
SynergyRob
I invented a game of double Chess called Synergy Chess. I am not a coder. I hired someone to write the program. People can play online fo...
1 738 1
New
riyajohnson
When it comes to selecting a framework for a development project, it’s crucial to make an informed decision. With so many options availab...
2 401 1
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
476 5781 112
New
AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
201 4638 102
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
193 4510 82
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
30 3579 14
New
New
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
27 2843 9
New
CommunityNews
Will Swifties’ war on AI fakes spark a deepfake porn reckoning?
0 5956 0
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
0 1782 0
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
14 1353 8
New