我试图基于两个不同的数组创建多个列表。我有一个名为categoryList和termsList的数组。我想将基于属性的术语列表分组到categoryList数组。const categoriesList = [ { name: 'Categories', slug: 'category' }, { name: 'Tags', slug: 'post_tag' }];和const termsList = [ { id: 1, taxonomy: 'category', name: 'First category' }, { id: 2, taxonomy: 'category', name: 'Second category' }, { id: 3, taxonomy: 'post_tag', name: 'First tag' }, { id: 4, taxonomy: 'post_tag', name: 'Second tag' }];类别列表中的属性段始终与termsList中的分类属性具有相同的值。我想要完成的是在React组件中做到这一点:<h1>Categories</h1><ul> <li>First category</li> <li>Second category</li></ul><h1>Tags</h1><ul> <li>First tag</li> <li>Second tag</li></ul>我不知道该怎么做。一些帮助将不胜感激。谢谢!
添加回答
举报
0/150
提交
取消