dethe
New Member
Posts: 2
|
Post by dethe on Dec 30, 2020 23:22:13 GMT
Hi folks,
if I am rendering an element, I know I can render children by specifying them in the tagged html like this: html`<wb-content><wb-child/></wb-content>`
What is the right way to do this if the number and type of child elements is not known until runtime? I've been creating each as a one-off, but that doesn't seem right (and is especially annoying since heresy doesn't have html.node for one-offs).
Imagine turning JSON content into tags, for arbitrarily-deep JSON.
Or is heresy the wrong tool for that?
Thanks!
--Dethe
|
|
dethe
New Member
Posts: 2
|
Post by dethe on Dec 31, 2020 19:42:01 GMT
Ah, I can generate a list of elements with WBChild.new() on each of them and insert the entire list:
html`<wb-content>${childList}</wb-content>`
That works. I thought I'd tried it before and it didn't.
|
|
|
Post by webreflection on Jan 1, 2021 15:44:28 GMT
you can pass array of elements and/or components without issue in any of my template literal based libraries 👋
|
|