【发布时间】:2021-01-30 08:26:42
【问题描述】:
使用 React,我试图将我的对象数组动态显示到侧面导航中。有没有一种有效的方法来清晰地映射和显示我的价值观?我尝试将选项卡和标题分成两个单独的数组并从选项卡中删除重复项。然后我能够映射和显示选项卡,但我将如何为标题执行此操作?有没有更简单的解决方案
类似的东西,但没有硬编码。
<div>Lead</div>
<div>new lead</div>
<div>reached out</div>
<div>Applicant</div>
<div>new applicant</div>
<div>recruiter screen</div>
<div>Interview</div>
<div>exploratory chat</div>
<div>hired</div>
我的对象数组:
nav = [
{tab: "Lead", title: "new lead"},
{tab: "Lead", title: "reached out"},
{tab: "Applicant", title: "new applicant"},
{tab: "Applicant", title: "recruiter screen"},
{tab: "Interview", title: "exploratory chat"},
{tab: "Interview", title: "hired"},
]
【问题讨论】:
标签: javascript html arrays reactjs jsx