Svelte and SvelteKit 5 · Runes (reactivity)

Reactive state

$state makes a value reactive. Objects and arrays are reactive deeply, so changing a property updates the page.

let todos = $state([{ text: "Learn runes", done: false }]);
todos[0].done = true;
todos.push({ text: "Build an app", done: false });

Official Svelte and SvelteKit 5 documentation

More runes (reactivity) commands

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

Was this page helpful?