gpt4 book ai didi

javascript - Cardlist 未定义 no-undef

转载 作者:行者123 更新时间:2023-12-02 23:07:05 25 4
gpt4 key购买 nike

我制作了cardList,想通过 map 将卡片添加到cardlist中,但出现此错误

import React from 'react';
import Card from './Card';

const Cardlist = ({robots})=>{
const cardComponent = robots.map((user,i) => {
return <Card name = {robots[i].name} id ={robots[i].id} email = {robots[i].email} />
})
return (
<div>
{cardComponent}
</div>
);
}

export default CardList;

最佳答案

您收到 Cardlist is not Defined,因为您没有正确导出它。

export default CardList;

应该变成

export default Cardlist;

关于javascript - Cardlist 未定义 no-undef,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57537295/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com