From b6fab71b9c26b863a9862ed883f8a9b61af7a6fd Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sat, 22 Apr 2023 23:00:28 -0400 Subject: ex 1.3 --- part1/courseinfo/src/App.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'part1/courseinfo/src') diff --git a/part1/courseinfo/src/App.js b/part1/courseinfo/src/App.js index 35bb178..70f0e8b 100644 --- a/part1/courseinfo/src/App.js +++ b/part1/courseinfo/src/App.js @@ -5,9 +5,10 @@ const Header = (props) => { } const Part = (props) => { +//// props.part is an object containing name and exercises return (

- {props.part} {props.desc} + {props.part.name} {props.part.exercises}

) } @@ -20,20 +21,28 @@ 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 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 + } return (
- - - - + + + +
) } -- cgit v1.2.3