I’ve been doing some more digging on Svelte and have learned some interesting stuff.
A basic thing is the way that Svelte just uses {brackets}
to demarcate dynamic content. Everything that is inside the brackets is just JavaScript.
Another very basic thing is how the control flow works. It’s very much as expected and supports {if}
with multiple {:else if}
branches all closed with a final {/if}
as well as {#each}
for iterating through a list.
More interesting is the #await
block which allows promises to be done with markup:
{#await aPromise}
Loading...
{:then result}
The result is {result}
{:catch error}
It didn't work: {error}
{/await}
That structure is very handy for simply rendering something from a web service call. Nice stuff!