diff --git a/part1/src/App.js b/part1/src/App.js index f1ded94..2bbce39 100644 --- a/part1/src/App.js +++ b/part1/src/App.js @@ -7,10 +7,11 @@ const Header = (props) => { } const Part = (props) => { + console.log(props) return ( <>
- {props.part} {props.exercise} + {props.part.name} {props.part.exercises}
> ) @@ -19,18 +20,19 @@ const Part = (props) => { const Content = (props) => { return ( <> -- Number of exercises {props.total} + Number of exercises {total}
> ) @@ -38,19 +40,25 @@ const Total = (props) => { 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 total = exercises3 + exercises2 + exercises1 + 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 = [part1, part2, part3] return (