Replies: 1 comment 3 replies
-
I do not see the issue with that. Svelte components also require
Often the boilerplate can be reduced by using export function useTime() {
let now = $state(new Date());
// other code...
return {
get now() {
return now
},
set now(value) {
now = value
},
}
} you return an object: export function useTime() {
let state = $state({ now: new Date() });
// other code...
return state;
} Though, even with getters and setters, for more complex scenarios this is probably still preferable to the mess that is the stores API in JS.
I would only use classes if I really need the performance, one of the reasons classes are not deeply reactive is to preserve speed. Use regular objects in
Bindable props are properties with a getter & setter, as has already been pointed out in your linked question.
This is not quite correct. The element is updated according to state changes so if the referenced state is changed later, the element will be updated. It just does not prevent the user or element from changing the state. If you want to prevent interaction with a form element, make it read-only or disabled, everything else is just confusing the user.
Updates for Svelte 5 will take some time, the new version has only been out for a few months, and for the most part, if there is a vanilla JS implementation of something, it can usually be integrated fairly easily.
If you are able to find any JS library that actually does this well, let me know because I have not come across one so far. I will agree that there is a certain increase in complexity regarding the base APIs. It is a tradeoff that yields more flexibility, a more uniform reactivity system and higher performance. The reactivity system in particular also simplifies certain things, e.g. stores are now obsolete (though of course they are still in use in various libraries). You claim that there are "many edge cases and quirks" but the same is true for previous Svelte versions, but you have gotten used to those or were luck enough to not run into them. Personally, I think Svelte 5 is an improvement overall but that it could be a bit more work to get into. |
Beta Was this translation helpful? Give feedback.
-
https://gist.github.com/rxliuli/c886198390a9fd1138853d0e260025f3
Just some complaints after using Svelte 5 for 3 months, each one will reference a Svelte GitHub issue or Reddit link for explanation. I posted the same content on Reddit, but it seems to have received a poor response. The claim made by defenders that "Svelte's reactivity doesn't exist at runtime" is entirely wrong in Svelte 5. I hope the discussion here can be a bit friendlier, especially regarding the possibility of improvements afterward.
Beta Was this translation helpful? Give feedback.
All reactions