What I need is to use async-await
in Svelte onMount()
.
Or maybe you can suggest me what is wrong and what I can use alternatively.
To Reproduce
- go here: https://svelte.dev/repl/000ae69c0fe14d9483678d4ace874726?version=3.23.0
- open the console
- click on the button
- you should see messages:
"Mounting..."
and"A lot of background work..."
- if you click again the destroy message is not written
WHY?
Did onMount()
recognizes the async
function promise? Should it?
I need that async
behavior because I need to wait for function lazyLoading()
before rendering the Child
component.
Is there an alternative way to do this in Svelte?