Question · Svelte and SvelteKit course · Module 3: Reactivity and Runes

Replacing $: in Svelte 5

What is the Svelte 5 equivalent of the old $: doubled = count * 2?

Answer options

  • let doubled = $state(count * 2)
  • let doubled = $derived(count * 2)
  • let doubled = $effect(count * 2)
  • let doubled = $computed(count * 2)

You can check the correct answer by solving this task in the CodeWorlds game.