-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
テーマ
await ブロック
問題文
Svelte の特徴でもある await ブロックの書き方で、以下の内で間違っているものを一つ選んでください。
A
{#await promise}
<p>...wait</p>
{:then number}
<p>The number is {number}</p>
{:catch error}
<p>{error.message}</p>
{/await}
B
{#await promise}
<p>...wait</p>
{:catch}
<p>error happened</p>
{/await}
C
{#await promise then number}
<p>The number is {number}</p>
{/await}
D
{#await promise catch}
<p>error happened</p>
{/await}
回答と解説
正解は D です!
この場合は下記のように引数を指定しなければなりません。
{#await promise catch error}
<p>error happened</p>
{/await}
await ブロックについてはこちら
https://sveltejp.dev/docs#await