Update 05-await.md

Closes #13990

Adds a example of dynamic component usage with the help of {#await...} syntax
pull/13993/head
Devr 2 years ago committed by GitHub
parent e99e865291
commit 2ca0dd8c20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -68,3 +68,12 @@ Similarly, if you only want to show the error state, you can omit the `then` blo
<p>The error is {error}</p> <p>The error is {error}</p>
{/await} {/await}
``` ```
Also you can render dynamic components with the help of import() function.
```svelte
{#await import('./Component.svelte') then Component}
<Component.default/>
{/await}
```
> [!NOTE] You need to add `.default` since components export a default only.

Loading…
Cancel
Save