<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.
Svelte and React makes different tradeoffs in how they expect developers to deal with this.
Personally I think maybe Svelte makes a better tradeoff. I've seen so many people make variables instead of using useState, etc… because that's the kind of thinking they're used to.
In Svelte that would simply work for the simple cases, but you'd have to use $: someVar for the more complex cases. I think requiring having to deal with that complexity only when you need it is a more reasonable way to do it compared to React.
Same size of the project in React will take 100Mb of drive space, and something more serious in industrial environment goes easily over 1Gb of disk storage, although I love React I find that insane. Even "Hello World" build of React will range between 2MB and xxMb depending on config.
If you think reactivity is the frameworks’ job I see no reason to praise React at all - especially with hooks you will be manually handling dependencies and updates everywhere, feels like a huge step back.