5 ms·
The only thing I don't like about Svelte is the reactive blocks, prefixed with $:. There are a number of gotchas, like updating complex objects, which make thin
by floodle 4y ago
The only thing I don't like about Svelte is the reactive blocks, prefixed with $:. There are a number of gotchas, like updating complex objects, which make things a bit...implicit rather than explicit.
- Tade0 4y agoRule of thumb is: it's fired after assignment of a named variable from the root scope which was mentioned in this reactive block. You can even add a line that just says `myVar;` and the reactive block containing it will be executed on every `myVar = ...`.
- 7sidedmarble 4y agoYeah I understand why people find them confusing. They trip me up too, and I write a lot of Svelte. I think it would have been better if Rich had added something like the computed/useEffect style of this concept, but it would have looked very out of place in the rest of Svelte which is probably why he didn't do it.
- pragmatic 4y agoReactivity is hard in any platform. If you don't like those, I wonder how you'd like the extensive use of rxjs in Angular. I think svelte has taken the best part of the rxjs observable pattern without the PhD level of insanity in the reactive frameworks. Beyond debouncing and throttling, the uses for rxjs style reactive patterns (all the variations of Subjects) gets super confusing fast. (Look at a moderate sized Angular app and you see the horror of types and brackets needed to handle http calls and errors correctly, for example).
- butterfly771 4y agoMaybe you need vue3 .value