DEV Community

Discussion on: Fetching Data in Svelte

Collapse
 
stefanovualto profile image
stefanovualto

Hi David,

Using a promise to fetch, you could use await blocks.

Have a look at this: svelte.dev/tutorial/await-blocks

Collapse
 
jrmoynihan profile image
jrmoynihan

Agreed. {#await...then...catch} is the preferred way to do this, especially considering the fetch is already within an async function, which will return a promise.