我的問題是關于如何部分迭代 React JSX 中的數組。我不想調用 .map 并遍歷 profile.categories 中的所有項目,而只想顯示數組中的前五個項目。我目前有以下代碼:<div className="categories"> {profile.categories.map(category => ( <div className="profile-categories" style={{ float: "left" }} > {category} </div> ))} </div>
如何在React JSX中循環遍歷數組中的某些項目
慕勒3428872
2022-01-07 20:44:36