A component can change its category altogether with <svelte:component>. Instead of a sequence of if blocks…

    1. {#if selected.color === 'red'}
    2. <RedThing/>
    3. {:else if selected.color === 'green'}
    4. <GreenThing/>
    5. {:else if selected.color === 'blue'}
    6. <BlueThing/>
    7. {/if}

    …we can have a single dynamic component:

    1. <svelte:component this={selected.component}/>

    The this value can be any component constructor, or a falsy value — if it’s falsy, no component is rendered.