<script>
function sw() {
return fetch(
`swapi.co/api/people/${Math.ceil(Math.random() * 10) + 1}`
).then(r => r.json());
}
</script>
{#await sw()}
<p>wait</p>
{:then c}
<p>{c.name}</p>
{/await}
It's only 80 seconds and you can add "await block in @sveltejs" to your LinkedIn 🥳
egghead.io/lessons/svelte…
let f = () => fetch(`swapi.co/api/people/${Math.ceil(Math.random() * 10)+1}`).then(r => r.json())
</script>
<style>*{font-family: "Comic Sans MS";color: magenta;}</style>
{#await f()}<p>wait</p>{:then c}<p>{c.name} | gender: {c.gender}</p>{/await}