From 88971745722b24ed71a7fba73432d7725ab23812 Mon Sep 17 00:00:00 2001 From: Jesse Skinner Date: Mon, 24 Feb 2020 20:39:42 -0500 Subject: [PATCH] Update wording to include prop behaviour In regards to #4442, this adds wording to explain that props are set to undefined when they are removed by the consumer. --- site/content/docs/01-component-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index 026a2da5b3..2101a0c7de 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -42,7 +42,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a *property* --- -You can specify a default value, which will be used if the component's consumer doesn't specify a prop. +You can specify a default value for a prop. It will be used if the component's consumer doesn't specify the prop on the component. Note that whenever a specified prop is removed by the consumer, the value is set to `undefined` rather than the default value. 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`.