Skip to content

Instantly share code, notes, and snippets.

@DylanPiercey
Last active January 3, 2019 15:21
Show Gist options
  • Save DylanPiercey/f2669f6fca5921e92ea7233135c2ecbf to your computer and use it in GitHub Desktop.
Save DylanPiercey/f2669f6fca5921e92ea7233135c2ecbf to your computer and use it in GitHub Desktop.
Recursive Marko component
$ const mockData = [{
id: 1,
title: "Comment",
content: "Content",
comments: [{
id: 2,
title: "Nested Comment",
content: "Nested Content"
}]
}]
<macro comments(list)>
<for(comment in list)>
<div key=comment.id>
${comment.title} - ${comment.content}
<comments(comment.comments)/>
</div>
</for>
</macro>
<comments(mockData)/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment