From 565f86e6fd75a80e4d3cea270e261a6230fd043b Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Sun, 12 Jun 2022 11:51:44 +0200 Subject: [PATCH] Exercise 1.4 --- part1/courseinfo/src/App.js | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) 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) => (
- - - + + +
) const Total = (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 (
- - + +
) }