0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 01:11:24 +01:00
svelte/site/content/tutorial/03-props/02-default-values/text.md

305 B

title
Default values

We can easily specify default values for props in Nested.svelte:

<script>
	export let answer = 'a mystery';
</script>

If we now add a second component without an answer prop, it will fall back to the default:

<Nested answer={42}/>
<Nested/>