3 回答

TA貢獻2039條經驗 獲得超8個贊
要使地圖正常工作,您必須傳遞一個允許選擇每個元素的變量。嘗試這個
const joiningCriteria = [
'People between the ages of 18 and 35 years.',
'A demonstrated passion for coding and technology.',
'The time and capacity to commit to a full coding bootcamp. Classes are three times per week in person at one of our learning hubs.',
'An intermediate level of English comprehension.',
'The aptitude to succeed in the selection process.',
];
return (
<ol>
{joiningCriteria.map((e,index)=> {return <li key={index}>{e}</li>} /*the error is here it say the (e) is not defined*/
)}
</ol>
</section>
); };

TA貢獻1871條經驗 獲得超13個贊
您需要將 e 作為參數添加到地圖中。然后,數組中的值將顯示為列表元素。
<ol> {joiningCriteria.map((e)=> (<li>{e}</li>))} </ol>
添加回答
舉報