Computed Values: $: reactive declarations
Derive values automatically from reactive state using the $: label syntax.
The $: Label
Prefix any statement with $: to make it reactive. It re-runs whenever the referenced variables change.
$: doubled = count * 2;Auto-Tracking
Svelte scans the right-hand side for variable references. You do not list dependencies manually.
All lessons in this course
- The script template style Structure
- Reactive Variables with let
- Interpolation: {expression}
- Computed Values: $: reactive declarations