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
- Component skeleton
- Reactive state
- Derived values
- Receive props
- Allow two-way binding of a prop
- Share state between components
All runes (reactivity) commands · Svelte and SvelteKit 5 cheatsheet