Svelte · Senior · Question 12 of 75

Why is a {#key} block an expensive way to re-run child logic?

Explanation

Wrap the dependent computation in $derived instead. Use {#key} deliberately, e.g. to replay transitions.

Further reading

Problem with a question

Svelte · Senior · question 12

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