Skip to content

Commit e88231b

Browse files
authored
docs: tweak tutorial (#879)
clarified the code slightly by providing file names where the changes apply for context and an example of the last use
1 parent 220fb5e commit e88231b

File tree

1 file changed

+8
-2
lines changed
  • apps/svelte.dev/content/tutorial/01-svelte/03-props/03-spread-props

1 file changed

+8
-2
lines changed

apps/svelte.dev/content/tutorial/01-svelte/03-props/03-spread-props/index.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Spread props
33
---
44

5-
In this exercise, we've forgotten to pass the `name` prop expected by `PackageInfo.svelte`, meaning the `<code>` element is empty and the npm link is broken.
5+
In this exercise, in `App.svelte` we've forgotten to pass the `name` prop expected by `PackageInfo.svelte`, meaning the `<code>` element is empty and the npm link is broken.
66

77
We _could_ fix it by adding the prop...
88

@@ -23,7 +23,7 @@ We _could_ fix it by adding the prop...
2323
<PackageInfo +++{...pkg}+++ />
2424
```
2525

26-
> [!NOTE] Conversely, you can get an object containing all the props that were passed into a component using a rest property...
26+
> [!NOTE] Conversely, in `PackageInfo.svelte` you can get an object containing all the props that were passed into a component using a rest property...
2727
>
2828
> ```js
2929
> let { name, ...stuff } = $props();
@@ -34,3 +34,9 @@ We _could_ fix it by adding the prop...
3434
> ```js
3535
> let stuff = $props();
3636
> ```
37+
>
38+
> ...in which case you can access the properties by their object paths:
39+
>
40+
> ```js
41+
> console.log(stuff.name, stuff.version, stuff.description, stuff.website)
42+
> ```

0 commit comments

Comments
 (0)