Update documentation/docs/03-template-syntax/05-await.md

pull/13993/head
Simon H 2 years ago committed by GitHub
parent 2ca0dd8c20
commit 4cc7e0e112
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -68,12 +68,11 @@ Similarly, if you only want to show the error state, you can omit the `then` blo
<p>The error is {error}</p>
{/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.
> [!NOTE] You can use `#await` to render dynamic components with the help of the `import()` function:
>
> ```svelte
> {#await import('./Component.svelte') then Component}
> <Component.default />
> {/await}
> ```

Loading…
Cancel
Save