From 1d48e78d7f7d429eb2b5fd2c98122797debf246a Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Tue, 20 May 2025 16:24:28 +0200 Subject: [PATCH] remove total, reformat --- parts/2/courseExercise/src/App.jsx | 69 +++++++++++++----------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/parts/2/courseExercise/src/App.jsx b/parts/2/courseExercise/src/App.jsx index 33c3557..65acd12 100644 --- a/parts/2/courseExercise/src/App.jsx +++ b/parts/2/courseExercise/src/App.jsx @@ -1,63 +1,52 @@ const Header = (props) => { - return

{props.course}

-} + return

{props.course}

; +}; const Part = (props) => { - return

{props.partName} {props.exerciseCount}

- -} + return ( +

+ {props.partName} {props.exerciseCount} +

+ ); +}; const Content = (props) => { return ( <> - {props.sections.map((section) => { - return - })} + {props.sections.map((section) => { + return ( + + ); + })} - ) -} - -const Total = (props) => { - return ( - <> -

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

- - ) -} - + ); +}; const App = () => { const course = { - name: 'Half Stack application development', + name: "Half Stack application development", sections: [ { - part: 'Fundamentals of React', - exerciseCount: 10 + part: "Fundamentals of React", + exerciseCount: 10, }, { - part: 'Using props to pass data', - exerciseCount: 7 + part: "Using props to pass data", + exerciseCount: 7, }, { - part: 'State of a component', - exerciseCount: 14 + part: "State of a component", + exerciseCount: 14, }, - - ] - } + ], + }; return (
-
- - +
+
- ) -} + ); +}; -export default App \ No newline at end of file +export default App;