I'm trying to loop through an array to render the component with the value of type
.
<script>
import One from './One.svelte';
import Two from './Two.svelte';
import Three from './Three.svelte';
const contents = [
{type: 'One'},
{type: 'Two'},
{type: 'Three'},
{type: 'One'}
]
</script>
{#each contents as content}
<{content.type} />
{/each}
Desired output:
<One />
<Two />
<Three />
<One />
What is the best way to do this?