When I run the following the output is `<html><body><h1></h1></body></html>`: import htmlElements template html*(name: untyped, children: untyped) = proc `name`*(): string = result = "<html>" children result.add("</html>") template component*[T](name: untyped, children: untyped) = template `name`*(props: typed) = children type MyProp = object text: string let props = MyProp(text:"") component[MyProp](MyComponent): h1: props.text html app: body: MyComponent(MyProp(text:"HELLO WORLD")) echo app() Run
This makes sense since a snapshot is taken of `children` at the moment when the component is created, not when `MyComponent` is called. What I need then is some way to hold `children` in queue and actually evaluate it when I pass the component to some parent.