Svelte · Junior · Frage 13 von 76
Wie bekommt eine Komponente in Svelte 5 Props?
<script>
let { name, count = 0 } = $props();
</script>- 1Mit der Rune
$props()und Destrukturierung - 2Mit
export let namefür jedes Prop - 3Über
this.propsin einer beliebigen Funktion
Antwort zeigen
Richtige Antwort: Mit der Rune $props() und Destrukturierung
Erklärung
export let ist die Syntax von Svelte 4. Mit $props() kann man auch den Rest einsammeln: let { a, ...rest } = $props().