diff --git a/parts/1/exerciseApp/src/App.jsx b/parts/1/exerciseApp/src/App.jsx index 566d84b..33c3557 100644 --- a/parts/1/exerciseApp/src/App.jsx +++ b/parts/1/exerciseApp/src/App.jsx @@ -20,42 +20,42 @@ const Content = (props) => { const Total = (props) => { return ( <> -

Number of exercises {props.totalExerciseCount}

+

Number of exercises {props.sections.reduce( + (sum, section) => { + return sum + section.exerciseCount + }, + 0 + )}

) } const App = () => { - const course = 'Half Stack application development' - const part1 = 'Fundamentals of React' - const exercises1 = 10 - const part2 = 'Using props to pass data' - const exercises2 = 7 - const part3 = 'State of a component' - const exercises3 = 14 - - const sections = [ - { - part: part1, - exerciseCount: exercises1 - }, - { - part: part2, - exerciseCount: exercises2 - }, - { - part: part3, - exerciseCount: exercises3 - }, - - ] + const course = { + name: 'Half Stack application development', + sections: [ + { + part: 'Fundamentals of React', + exerciseCount: 10 + }, + { + part: 'Using props to pass data', + exerciseCount: 7 + }, + { + part: 'State of a component', + exerciseCount: 14 + }, + + ] + } return (
-
- - +
+ +
) } diff --git a/parts/1/notes.md b/parts/1/notes.md index b42ea3d..c6d3c15 100644 --- a/parts/1/notes.md +++ b/parts/1/notes.md @@ -2,9 +2,9 @@ How to start a react app: `npm create vite@latest -- --template react` Exercises: -* [ ] 1.1 -* [ ] 1.2 -* [ ] 1.3 -* [ ] 1.4 -* [ ] 1.5 +* [X] 1.1 +* [X] 1.2 +* [X] 1.3 +* [X] 1.4 +* [X] 1.5