mirror of
https://github.com/10h30/fullstackopen.git
synced 2026-06-05 15:08:33 +09:00
Completed 2.3
This commit is contained in:
@@ -65,9 +65,10 @@ const Part = (props) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Total = (props) => {
|
const Total = ({part}) => {
|
||||||
|
const total = part.reduce((sum, p) => sum + p.exercises, 0)
|
||||||
return (
|
return (
|
||||||
<p><strong>Total of exercises {props.part[0].exercises + props.part[1].exercises + props.part[2].exercises + props.part[3].exercises}</strong></p>
|
<p><strong>Total of exercises {total}</strong></p>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user