Svelte · Junior · Question 13 of 76

How does a component receive props in Svelte 5?

<script>
  let { name, count = 0 } = $props();
</script>

Explanation

export let is the Svelte 4 syntax. With $props() you can also collect the rest: let { a, ...rest } = $props().

Further reading

Problem with a question

Svelte · Junior · question 13

Test yourself

Take the Svelte · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz