-
-
Save roman01la/516c4d11e103d075c7854fe9129bb970 to your computer and use it in GitHub Desktop.
Templating critique
This file contains hidden or 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
(defn list-container [items] | |
[:.list-container | |
(if (seq items) | |
[:ul | |
(for [{:keys [name id]} items] | |
[:li {:key id} name])] | |
[:p "No items found."])]) |
This file contains hidden or 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
let ListContainer = ({ items }) => | |
<div className="list-container"> | |
{items.length ? <ul> | |
{items.map(item => | |
<li key={item.id}>{item.name}</li>} | |
</ul> : <p>No items found</p>} | |
</div> |
This file contains hidden or 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
<template> | |
<div class="list-container"> | |
<ul v-if="items.length"> | |
<li v-for="item in items"> | |
{{item.name}} | |
</li> | |
</ul> | |
<p v-else>No items found.</p> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment