Svelte · Middle · Question 50 of 75

How do you show a loading indicator during SvelteKit navigation?

<script>
  import { navigating } from "$app/state";
</script>

{#if navigating.to}<ProgressBar />{/if}

Explanation

navigating has from, to and type. On the server its values are null.

Further reading

Problem with a question

Svelte · Middle · question 50

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz