Svelte · Junior · Question 34 of 76

How do you render a component chosen at runtime in Svelte 5?

<script>
  let { Component } = $props();
</script>

<Component />

Explanation

Components are dynamic in runes mode, so <svelte:component> is no longer needed.

Further reading

Problem with a question

Svelte · Junior · question 34

Test yourself

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

Take this quiz