Svelte 5 runes
The core runes you use day to day.
$state
functionlet v = $state(initial) Creates deeply reactive state.
| Prop | Type | Required | Description |
|---|---|---|---|
initial | T | Yes | Initial value. |
$derived
functionlet v = $derived(expr) A read-only value recomputed from other state.
| Prop | Type | Required | Description |
|---|---|---|---|
expr | T | Yes | Pure expression. |
$effect
function$effect(() => { ... }) Runs a side effect after the DOM updates; return a cleanup fn.
$props
functionlet { a, b } = $props() Reads the component props.
$bindable
functionlet { v = $bindable(d) } = $props() Marks a prop as two-way bindable.
| Prop | Type | Required | Description |
|---|---|---|---|
d | T | — | Default value. |