我有一个对象数组,它们有一个 key Component,它指向其各自的组件。
我能够映射数组并显示所有组件,如下所示,
dict.map(({ Component }) => <Component />这可行,但是我正在尝试有条件地渲染特定组件。就我而言,我试图访问Componentindex 处的属性1,但它似乎不起作用。我尝试访问它的方式类似于,,dict[displayComponentAtIndex].Component其中displayComponentAtIndex是状态的一部分。
如何按照我想要的方式渲染组件?
偶然的你
ITMISS
随时随地看视频慕课网APP
相关分类