0Pricing
Sveltejs Academy · Lesson

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

  1. The script template style Structure
  2. Reactive Variables with let
  3. Interpolation: {expression}
  4. Computed Values: $: reactive declarations
← Back to Sveltejs Academy