Reactivity for Sveltes
Reactivity in Svelte 5 means the interface updates automatically when data changes, driven by runes such as $state, $derived and $effect. It sits at the core of every component, and the template syntax, with its curly-brace expressions, #if and #each blocks, is how that data reaches the screen.
Stage: Svelte Basics · Part of the Svelte roadmap · Last reviewed 19 November 2026
What to learn in Reactivity
- Declare reactive values with $state and read them directly in markup
- Compute values from other state using $derived instead of manual updates
- Run side effects safely with $effect and know when to avoid it
- Render lists with an each block and a keyed identity
- Bind form inputs to state with bind:value
- Pass data into a component using $props
Reactivity interview questions
What is the difference between $derived and $effect in Svelte 5?
$derived computes a value from other reactive values and stays in sync automatically, so it suits anything you can express as a calculation. $effect runs code for side effects, such as updating the document title or calling a browser API, after the DOM has updated.
Why should an each block in Svelte have a key?
A key tells Svelte which item is which when the list changes. Without it, Svelte reuses DOM nodes by position, which can leave stale input values or animations on the wrong row after reordering, inserting or deleting items.
Where Reactivity fits in the Svelte roadmap
Reactivity belongs to the Svelte Basics stage (beginner level), which takes about 15 hours. Components and runes.
Other units in this stage
Back to the full Svelte roadmap