Skip to content

Commit e5e675d

Browse files
docs: remove deep nesting example and add override example to expressions
1 parent 3fac864 commit e5e675d

File tree

2 files changed

+6
-47
lines changed

2 files changed

+6
-47
lines changed

documentation/docs/01-introduction/xx-props.md

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -43,51 +43,11 @@ You can specify a fallback value for a prop. It will be used if the component's
4343
4444
<Nested answer={42} /> <!-- answer is set to 42 -->
4545
<Nested answer={null} /> <!-- answer is set to null (default value is not used)-->
46-
<Nested /> <!-- answer is set 3 (default value) -->
47-
<Nested answer={undefined}/> <!-- answer is set 3 (default value) -->
46+
<Nested /> <!-- answer is set to 3 (default value) -->
47+
<Nested answer={undefined}/> <!-- answer is set to 3 (default value) -->
4848
4949
```
5050

51-
Deep nesting refers to having components nested within other components across multiple levels. In this setup, props can be passed from parent to child components through several layers.
52-
53-
```svelte
54-
<script>
55-
let count = 3;
56-
</script>
57-
58-
<!-- App.svelte -->
59-
<First {count} />
60-
```
61-
62-
```svelte
63-
<script>
64-
export let count;
65-
</script>
66-
67-
<!-- First.svelte -->
68-
<p>First: {count}</p>
69-
<Second {count} />
70-
```
71-
72-
```svelte
73-
<script>
74-
export let count;
75-
</script>
76-
77-
<!-- Second.svelte -->
78-
<p>Second: {count}</p>
79-
<Third {count} />
80-
```
81-
82-
```svelte
83-
<script>
84-
export let count;
85-
</script>
86-
87-
<!-- Third.svelte -->
88-
<p>Third: {count}</p>
89-
```
90-
9151
To get all properties, use rest syntax:
9252

9353
```svelte

documentation/docs/03-template-syntax/01-basic-markup.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,16 @@ When using {expression} inside markup, Svelte automatically converts the value t
188188
let emptyStr = "";
189189
let num = 1;
190190
let bool = false;
191-
let obj = { key: "value" };
192-
let objToStr = obj.toString();
191+
let obj1 = { key: "value" };
192+
let obj2 = { toString: () => "str" };
193193
let empty = undefined;
194194
let nul = null;
195195
196-
197196
<p>{emptyStr}</p> <!-- Renders as: <p></p> -->
198197
<p>{num}</p> <!-- Renders as: <p>1</p> -->
199198
<p>{bool}</p> <!-- Renders as: <p>false</p> -->
200-
<p>{obj}</p> <!-- Renders as: <p>[object Object]</p> -->
201-
<p>{objToStr}</p> <!-- Renders as: <p>[object Object]</p> -->
199+
<p>{obj1}</p> <!-- Renders as: <p>[object Object]</p> -->
200+
<p>{obj2}</p> <!-- Renders as: <p>str</p> -->
202201
<p>{empty}</p> <!-- Renders as: <p></p> (empty string) -->
203202
<p>{nul}</p> <!-- Renders as: <p></p> -->
204203
```

0 commit comments

Comments
 (0)