Destructure in maps for less duplication

This commit is contained in:
thiloho
2025-04-29 03:19:12 +02:00
parent f6a5e2518f
commit 036d806313
6 changed files with 19 additions and 33 deletions

View File

@@ -15,15 +15,12 @@ const sortedArticles = allArticles.sort((a, b) => {
>
<ul>
{
sortedArticles.map((article) => (
sortedArticles.map(({ id, data: { title, pubDate } }) => (
<li>
<Date date={article.data.pubDate} />
<Date date={pubDate} />
<span>&raquo;</span>
<a
class="text-blue-800 hover:no-underline"
href={`/blog/${article.id}`}
>
{article.data.title}
<a class="text-blue-800 hover:no-underline" href={`/blog/${id}`}>
{title}
</a>
</li>
))