I like the gist of this article, but how would these components be nested? (Or how could you add this?) That’s something I really need. I checked the source repo, there is no nesting.

Also, wouldn’t using innerhtml cause scroll positions etc to be lost?

Original author here.

I don't think nesting is possible in the examples in that post. I'm sure there's some way to get it working that I just haven't figured out yet. Maybe you could replace the default template strings with something using tagged template literals (like https://github.com/developit/htm).

You can work around nesting by spinning up new components after the innerHTML assignment, and assigning them with IDs. Here's an example where I've done that:

https://github.com/bryanbraun/music-box-fun/blob/dc899c14adc...

Edit: typos