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/>


		
loading editor...

Console

loading Svelte compiler...


		
loading editor...

Compiler options

result = svelte.compile(source, {
generate:
});


		
loading editor...