I have a function that returns the HTML code for a custom component. That code, together with more HTML code, is then rendered somewhere else with {@html codeToDisplay}
.
My firsts two guesses where:
- Return the code for the component as I would write it in a Svelte file and hope for Svelte to do it's magic
- Return the code for the component but using the special element
svelte:component
I also checked out the Custom element API but it didn't work.
I made a small REPL to see what I did.
So my question is: can Svelte render a custom component from valid HTML code?