.map 不是 React 中带有 Styled Component 的函数
.map is not a function with Styled Component in React
我有这个 returns 错误的小代码块:
“类型错误:object.attributeCollection.first.map 不是一个函数”
<StyledRow>
{object.attributeCollection.first.map((attribute) => (
<LabelAssistant attribute={attribute} />
))}
</StyledRow>
控制台中的对象如下所示:
谁能告诉我哪里可能出错了?
map
是一个 Array method。 first
是 StringAttributeModel
不是数组。
我有这个 returns 错误的小代码块:
“类型错误:object.attributeCollection.first.map 不是一个函数”
<StyledRow>
{object.attributeCollection.first.map((attribute) => (
<LabelAssistant attribute={attribute} />
))}
</StyledRow>
控制台中的对象如下所示:
谁能告诉我哪里可能出错了?
map
是一个 Array method。 first
是 StringAttributeModel
不是数组。