Svelte 5 is here, and with it comes runes — a fundamental shift in how reactivity works in Svelte. If you’ve been using Svelte 4, you’re used to $: reactive declarations and the writable store. Runes replace all of that with a cleaner, more explicit API.
What are Runes?
Runes are special syntax in Svelte 5 that tell the compiler how to handle reactivity. Unlike Svelte 4’s magic, runes are explicit:
<script>
let count = $state(0);
let doubled = $derived(count * 2);
function increment() {
count++;
}
</script>
<button onclick={increment}>
Count: {count}, Doubled: {doubled}
</button> Key Runes
$state— reactive state, replaceslet$derived— computed values, replaces$:declarations$effect— side effects, replaces$: { ... }blocks$props— component props, replacesexport let
Why Runes?
Svelte 4’s implicit reactivity was magical, but it created issues:
- Confusion between reactive and non-reactive variables
- Hard to reuse logic (no composable stores equivalent)
- TypeScript struggled with the magic
Runes solve all of this. Your IDE understands them, TypeScript works correctly, and you can extract logic into plain .svelte.ts files.
Conclusion
Svelte 5 with runes is a huge improvement for large-scale applications. The learning curve is minimal if you already know Svelte, and the benefits are immediate.