DEV Community

loading...

Discussion on: Consuming an API in Svelte

Collapse
federicovarela profile image
FedericoVarela

If you aren't displaying anything while awaiting the promise you can write the await and then together:
{#await promise then value}
< Card data={value} />
{/await}

Collapse
3ddpaz profile image
Ed

What about, if you want to do the promise only when a button is pressed ? let's say update a form. that lives with another promise already executed.?? you still need to check undefined before.. other wise you will show "form updated correctly" on the promise...