diff --git a/part1/courseinfo/src/App.js b/part1/courseinfo/src/App.js index a9f2790..3a8fa56 100644 --- a/part1/courseinfo/src/App.js +++ b/part1/courseinfo/src/App.js @@ -8,36 +8,38 @@ const Part = (props) => ( const Content = (props) => (
Number of exercises {props.total}
+Number of exercises {props.parts[0].exercises + props.parts[1].exercises + props.parts[2].exercises}
) const App = () => { const course = 'Half Stack application development' - const part1 = { - name: 'Fundamentals of React', - exercises: 10 - } - const part2 = { - name: 'Using props to pass data', - exercises: 7 - } - const part3 = { - name: 'State of a component', - exercises: 14 - } + const parts = [ + { + name: 'Fundamentals of React', + exercises: 10 + }, + { + name: 'Using props to pass data', + exercises: 7 + }, + { + name: 'State of a component', + exercises: 14 + } + ] return (