I'm following a React tutorial that creates a clickable 5 star rating system, and am stuck on what seems like a basic Javascript point. In the anonymous map function below, why is the n necessary?
When I try removing the n, the app begins returning "NaN out of 5 stars" instead of a real number. But why is this? The n seemingly isn't even used in the function at all.
{createArray(totalStars).map((n, i) => (
<Star
key={i}
selected={selectedStars > i}
onSelect={() => setSelectedStars(i + 1)}
/>
))}
Thank you!!