Last active
January 3, 2019 15:21
-
-
Save DylanPiercey/f2669f6fca5921e92ea7233135c2ecbf to your computer and use it in GitHub Desktop.
Recursive Marko component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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