我通過道具發送數組通過道具,但我不能使用陣列上的地圖。它說,不能使用通過道具發送的數組
.MAP不是一個函數
我的代碼:
const AuthorList = (authors) => {
return(
<table className="table">
<thead>
<tr>Firstname</tr>
<tr>Lastname</tr>
</thead>
<tbody>
{authors.map(author =>
<AuthorListRow key={author.id} author={author} />
)}
</tbody>
</table>
);
};
這就是Chrome的開發做出反應工具的樣子:
非常感謝!我知道爲什麼它不工作,這是失去{},只從道具提取作者。謝謝! –