I have ControlSection
component that one of it's props is statistics
object prop. I want to display with <h2>
all the key and values of the object. How can I do it?
ControlSection:
const ControlSection = ({ statistics }) => {
return (
<div className='gameStatistics'>
{
Object.keys(statistics).forEach(key =>
<h2>key: statistics[key]</h2>
)
}
</div>
)
}
Statistics example:
const statistics = {
Score: score,
Level: level,
Best: bestScore,
};