I'm trying to remove duplicates in the array. I have tags from posts, which is also array:
tags: ['react', 'javascript', 'node']
and from map function I have output like this:
node react javascript react javascript react javascript node
<div class="tags">
{posts.map(post =>
post.frontmatter.tags.map(tag => (
<Link
key={tag + `tag`}
to={`/tags/${kebabCase(tag)}/`}
className="tag is light"
>
{tag}
</Link>
))
)}
</div>
I've tried to implement .filter
and reduce
, but I'm stuck.
Thanks in advance