|
Thank you to author for pointing out some negatives here. The 5th version made two "non-error", but ergonomic changes, for the sake of larger code bases and standard formats over quick, yet reliable, reactive and testable code (which first attracted me to svelte):
- the need for getters and setters when using $runes in functions; this is a waste of time and almost always unnecessary in the contexts in which one uses small store classes. Not that Svelte 4 was better, it was different.. in a pinch, I'd take 4 though.
- using folders for routing and using standard page.svelte.js and server.svelte.js naming for everything; it clutters your IDE file list. You could say it's good practise, but limiting to one component per file also causes more files in some cases than multiple components per file (as is possible in React) Despite all this, Svelte 5 introduces $writable, which is kind of for the use case of one-off simple state - which doesn't need getters/setters - so the whole thing doesn't feel that consistent. I don't mind using consistent runes - that is a bit of boilerplate, but makes it easier to reason about. I still love the reactivity of using bind (like Vue) and using $effect with it automatically figuring out what to do without the footguns of Reacts useEffect. I love that I can just start writing files and routing will work, css can just go there without a node module to process it. Increasingly, I've realised React is probably going to remain my number 1:
- Recent changes are mostly just shorthands to reduce boilerplate
- Mobx has got state down
- Hooks have footguns, but I know them
- The eco-system is still unmatched
- `use` and other statements allowing async loading (like other recent shorthands) is helpful, a lot of my components used to have boilerplate to do async stuff, and it took effort to make failure cases/loading work well. This pairs very well with server functions too. |
Yes, but then you can just use a class.
> using folders for routing and using standard page.svelte.js and server.svelte.js naming for everything
This wasn’t introduced with Svelte 5, this is SvelteKit.
> Despite all this, Svelte 5 introduces $writable
No it doesn’t? Do you mean $state()?