$state: Fine-Grained Reactivity
Declare reactive state with the $state rune for granular DOM updates.
Declare State
Use $state(initial) to declare a reactive variable.
let count = $state(0);Reassign Normally
Update with regular assignment. Svelte re-renders dependent UI.
count = count + 1;All lessons in this course
- Why Runes: Moving Beyond the Compiler Magic
- $state: Fine-Grained Reactivity
- $derived: Declarative Computed Values
- $effect: Side Effects