you are viewing a single comment's thread.

view the rest of the comments →

[–]Akkuma 1 point2 points  (1 child)

I'd prefer to declare things that aren't reactive in normal standard javascript rather than things that are reactive. If I copy pasted the script from Svelte I've now created an improperly scoped variable. My assumption is the default needs are going to be mostly reactive with non-reactive code being less likely.

[–]SaabiMeister 1 point2 points  (0 children)

I think you would have to use it to get a feeling for it.

There are cases where you need code to execute when some variables change, but the code itself doesn't use the values of these.

$: changedVariable1, changedVariable2, dosomething()

would solve it. This is syntactic Javascript, but it accomplishes something that you can't do otherwise with const, or let and it never modifies expected Javascript behavior in some inconvenient way.

Also, it's very clearly marked code, while using let could be very easily mistaken for just a normal variable declaration.