async function sw() {
let r = await fetch(
`swapi.co/api/people/${Math.ceil(Math.random() * 9) + 1}/`
);
return await r.json();
}
let p = sw();
</script>
{#await p}<p>Loading...</p>{:then char}<pre>{JSON.stringify(char, null, 2)}</pre>{/await}
I also have an egghead playlist which will help you get started with @sveltejs in only 20 minutes 🥳
egghead.io/playlists/gett…