Skip to content

Deprecation: imperative render calls

Taylor Hunt edited this page Aug 2, 2019 · 2 revisions

Directly rendering by passing around the out variable within a template is deprecated in favor of the <${dynamic}> syntax for dynamic tagnames.

Manual rendering can create code that is hard to follow and impossible for Marko to optimize.

Here are some examples of how you can migrate existing code to use dynamic tagnames and dynamic attributes:

  1. input.renderBody(out)
    …becomes:
    <${input}/>
  2. input.renderThing(out)
    …becomes:
    <${input.renderThing}/>
  3. input.renderBody(out, attrs)
    …becomes:
    <${input} ...attrs/>
  4. renderBody(out)
    …becomes:
    <${renderBody}/>
  5. input.template.render({ a: "b" }, out)
    …becomes:
    <${input.template} a="b"/>
  6. input.template.renderer({ a: "b" }, out)
    …becomes:
    <${input.template} a="b"/>
  7. input.barRenderer({ a: "b" }, out)
    …becomes:
    <${{ render: input.barRenderer }} a="b"/>