Svelte · Senior · Question 48 of 75

Why does SvelteKit keep page components mounted when navigating between /blog/a and /blog/b?

Explanation

let title = data.post.title would keep the old title; let title = $derived(data.post.title) updates. {#key} would force a remount, at a cost.

Further reading

Problem with a question

Svelte · Senior · question 48

Test yourself

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

Take this quiz