You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/documentation/tutorial/03-props/02-default-values/text.md

19 lines
311 B

---
title: Default values
---
We can easily specify default values for props in `Nested.svelte`:
```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:
```svelte
<Nested answer={42} />
<Nested />
6 years ago
```