docs: improve lazy import example (#14076)

* docs: improve lazy import example

* Update documentation/docs/03-template-syntax/05-await.md
pull/14080/head
Rich Harris 5 days ago committed by GitHub
parent b0d255aefe
commit 0ed914b2e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -69,11 +69,11 @@ Similarly, if you only want to show the error state, you can omit the `then` blo
{/await}
```
> [!NOTE] You can use `#await` to render dynamic components with the help of the `import()` function:
> [!NOTE] You can use `#await` with [`import(...)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) to render components lazily:
>
> ```svelte
> {#await import('./Component.svelte') then Component}
> <Component.default />
> {#await import('./Component.svelte') then { default: Component }}
> <Component />
> {/await}
> ```

Loading…
Cancel
Save