You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/svelte.dev/content/docs/svelte/98-reference/.generated/shared-errors.md
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,43 @@ Certain lifecycle methods can only be used during component initialisation. To f
60
60
<button onclick={handleClick}>click me</button>
61
61
```
62
62
63
+
### snippet_without_render_tag
64
+
65
+
```
66
+
Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
67
+
```
68
+
69
+
A component throwing this error will look something like this (`children` is not being rendered):
70
+
71
+
```svelte
72
+
<script>
73
+
let { children } = $props();
74
+
</script>
75
+
76
+
{children}
77
+
```
78
+
79
+
...or like this (a parent component is passing a snippet where a non-snippet value is expected):
80
+
81
+
```svelte
82
+
<!--- file: Parent.svelte --->
83
+
<ChildComponent>
84
+
{#snippet label()}
85
+
<span>Hi!</span>
86
+
{/snippet}
87
+
</ChildComponent>
88
+
```
89
+
90
+
```svelte
91
+
<!--- file: Child.svelte --->
92
+
<script>
93
+
let { label } = $props();
94
+
</script>
95
+
96
+
<!-- This component doesn't expect a snippet, but the parent provided one -->
Copy file name to clipboardExpand all lines: apps/svelte.dev/content/docs/svelte/98-reference/30-runtime-errors.md
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -244,6 +244,43 @@ Certain lifecycle methods can only be used during component initialisation. To f
244
244
<button onclick={handleClick}>click me</button>
245
245
```
246
246
247
+
### snippet_without_render_tag
248
+
249
+
```
250
+
Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
251
+
```
252
+
253
+
A component throwing this error will look something like this (`children` is not being rendered):
254
+
255
+
```svelte
256
+
<script>
257
+
let { children } = $props();
258
+
</script>
259
+
260
+
{children}
261
+
```
262
+
263
+
...or like this (a parent component is passing a snippet where a non-snippet value is expected):
264
+
265
+
```svelte
266
+
<!--- file: Parent.svelte --->
267
+
<ChildComponent>
268
+
{#snippet label()}
269
+
<span>Hi!</span>
270
+
{/snippet}
271
+
</ChildComponent>
272
+
```
273
+
274
+
```svelte
275
+
<!--- file: Child.svelte --->
276
+
<script>
277
+
let { label } = $props();
278
+
</script>
279
+
280
+
<!-- This component doesn't expect a snippet, but the parent provided one -->
0 commit comments