Svelte · Junior · Question 34 of 76
How do you render a component chosen at runtime in Svelte 5?
<script>
let { Component } = $props();
</script>
<Component />- ✓Correct answer: Use the variable holding the component directly as a tag
- 2You must use
<svelte:component this={Component} /> - 3It's impossible without a router
Explanation
Components are dynamic in runes mode, so <svelte:component> is no longer needed.