Created
March 5, 2018 04:22
-
-
Save imballinst/3bbd829b82bfa2a3cb7e2e671c744f1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renderStudentsScore = (subjects) => { | |
const arrayOfDivs = []; | |
Object.keys(subjects).forEach(subjectName => { | |
const list = subjects[subjectName].map(({ id, name, score }) => ( | |
<li key={`student-id-${id}`}> | |
{name}: {score} | |
</li> | |
)); | |
arrayOfDivs.push( | |
<div key={`scores-${subjectName}`}> | |
<h4 style={{ textTransform: 'capitalize' }}>{subjectName} Scores</h4> | |
<ul>{list}</ul> | |
</div> | |
); | |
}); | |
return arrayOfDivs; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment