我制作了cardList,并想通过地图将卡片添加到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,因为您未正确导出Cardlist。
export default CardList;
应该成为
export default Cardlist;