3 回答

TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊
要使地圖正常工作,您必須傳遞一個(gè)允許選擇每個(gè)元素的變量。嘗試這個(gè)
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貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超13個(gè)贊
您需要將 e 作為參數(shù)添加到地圖中。然后,數(shù)組中的值將顯示為列表元素。
<ol> {joiningCriteria.map((e)=> (<li>{e}</li>))} </ol>
添加回答
舉報(bào)