Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to show a loading state in sveltekit correctly?

$
0
0

I want to show a spinner in +layout.svelte, while the +page.js is fetching data. With the code below the navigating is not available until all api calls have finished. After the loading I see the console.log.

What ist wrong? How can I show the loading state correctly?

+layout.svelte

<script>  import { navigating } from '$app/stores';  console.log(navigating)</script><main>      {#if $navigating}<Spinner />      {:else}<slot />      {/if}</main>

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>