mirror of https://github.com/sveltejs/svelte
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.
18 lines
286 B
18 lines
286 B
6 years ago
|
---
|
||
|
title: Default values
|
||
|
---
|
||
|
|
||
|
We can easily specify default values for props:
|
||
|
|
||
|
```html
|
||
|
<script>
|
||
|
export let answer = 'a mystery';
|
||
|
</script>
|
||
|
```
|
||
|
|
||
|
If we now instantiate the component without an `answer` prop, it will fall back to the default:
|
||
|
|
||
|
```html
|
||
|
<Nested answer={42}/>
|
||
|
<Nested/>
|
||
|
```
|