Svelte and SvelteKit 5 · Runes (reactivity)

Side effects

$effect runs after the DOM updates and re-runs when the state it reads changes. Use it for things outside Svelte, not to derive state.

$effect(() => {
  document.title = `Count: ${count}`;
});

Official Svelte and SvelteKit 5 documentation

More runes (reactivity) commands

All runes (reactivity) commands · Svelte and SvelteKit 5 cheatsheet

Was this page helpful?