-
Notifications
You must be signed in to change notification settings - Fork 644
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:
-
input.renderBody(out) …becomes: <${input}/>
-
input.renderThing(out) …becomes: <${input.renderThing}/>
-
input.renderBody(out, attrs) …becomes: <${input} ...attrs/>
-
renderBody(out) …becomes: <${renderBody}/>
-
input.template.render({ a: "b" }, out) …becomes: <${input.template} a="b"/>
-
input.template.renderer({ a: "b" }, out) …becomes: <${input.template} a="b"/>
-
input.barRenderer({ a: "b" }, out) …becomes: <${{ render: input.barRenderer }} a="b"/>
To automatically fix deprecated marko syntax, try the marko migrate
command from the CLI.