diff --git a/site/content/docs/01-component-format.md b/site/content/docs/01-component-format.md index ddd2667075..b60457d5af 100644 --- a/site/content/docs/01-component-format.md +++ b/site/content/docs/01-component-format.md @@ -28,41 +28,60 @@ A ` +``` + +--- + +You can specify a default value, which will be used if the component's consumer doesn't specify a prop. + +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`. + +```html + +``` + +--- - // you can use export { ... as ... } to have - // props whose names are reserved keywords - let clazz; - export { clazz as class }; +If you export a `const`, `class` or `function`, it is readonly from outside the component. Function *expressions* are valid props, however. - // this property is readonly externally - export const buzz = 'buzz'; +```html + +``` + +--- + +You can use reserved words as prop names. + +```html + ``` @@ -81,8 +100,8 @@ Because Svelte's reactivity is based on assignments, using array methods like `. let count = 0; function handleClick () { - // calling this function will trigger a re-render - // if the markup references `count` + // calling this function will trigger an + // update if the markup references `count` count = count + 1; } diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index ceaa19a398..981224fc14 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -20,7 +20,7 @@ A lowercase tag, like `