3 ms·
Yeah, I know nothing about frontend frameworks (Angular was just getting started last time I did any frontend work), and having read about Svelte for the first
by meowface 6y ago
Yeah, I know nothing about frontend frameworks (Angular was just getting started last time I did any frontend work), and having read about Svelte for the first time just now, the "$:" thing seems pretty reasonable to me.
<script>
let count = 0;
$: doubled = count * 2;
</script>
<p>{count} doubled is {doubled}</p>
I'd be very confused if `doubled` were to somehow automatically update any time the value of `count` changes, if merely defined as a standard variable (e.g. `let doubled = count * 2;`). This would totally break my mental programming model.
I'm not sure what the parent commenter had in mind as an alternative, or how it could be made simpler or terser.
- systemvoltage 6y agoI've been wrong about all this, I need to go through the tutorials again and try to understand this better. Apologies.