Skip to content

Commit 99e452e

Browse files
authored
Merge pull request #64 from sveltejs/master
docs: clarify default prop behaviour (sveltejs#4460)
2 parents 351f8a1 + 20e0790 commit 99e452e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

site/content/docs/01-component-format.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*
4242

4343
---
4444

45-
You can specify a default value, which will be used if the component's consumer doesn't specify a prop.
45+
You can specify a default initial value for a prop. It will be used if the component's consumer doesn't specify the prop on the component (or if its initial value is `undefined`) when instantiating the component. Note that whenever a prop is removed by the consumer, its value is set to `undefined` rather than the initial value.
4646

47-
In development mode (see the [compiler options](docs#svelte_compile)), a warning will be printed if no default is provided and the consumer does not specify a value. To squelch this warning, ensure that a default is specified, even if it is `undefined`.
47+
In development mode (see the [compiler options](docs#svelte_compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
4848

4949
```html
5050
<script>
51-
export let bar = 'optional default value';
51+
export let bar = 'optional default initial value';
5252
export let baz = undefined;
5353
</script>
5454
```

0 commit comments

Comments
 (0)