Skip to content

Commit

Permalink
docs: clarify statement about initial values for props (sveltejs#8477)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesscottbrown authored Apr 18, 2023
1 parent 6e1674e commit 1770fc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion site/content/docs/02-component-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property*

---

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.
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 if the values of props are subsequently updated, then any prop whose value is not specified will be set to `undefined` (rather than its initial value).

In development mode (see the [compiler options](/docs#compile-time-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`.

Expand Down

0 comments on commit 1770fc1

Please sign in to comment.