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