4 ms·
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 re
by Epskampie 7y ago
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?
- bryanbraun 7y agoOriginal 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 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/dc899c14adcd4b228b243cee1e88a394e204f805/js/components/note-lines.js#L22-L25 https://github.com/bryanbraun/music-box-fun/blob/dc899c14adc... Edit: typos