aboutsummaryrefslogtreecommitdiff
path: root/part2
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-04-27 23:51:24 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2023-04-27 23:51:24 -0400
commit9a4ee1ad06006367e50249719ef5cde23fec7626 (patch)
treee208d63bc0273068955e2f9155366b131fd04575 /part2
parent1c0338849c30be2ce62eb71211a88d384e9af046 (diff)
2.4 handles multiple course components
Diffstat (limited to 'part2')
-rw-r--r--part2/courseinfo2/src/App.js75
1 files changed, 56 insertions, 19 deletions
diff --git a/part2/courseinfo2/src/App.js b/part2/courseinfo2/src/App.js
index a4647ec..720ea29 100644
--- a/part2/courseinfo2/src/App.js
+++ b/part2/courseinfo2/src/App.js
@@ -55,29 +55,66 @@ const Course = (props) => {
}
const App = () => {
- const course = {
- id: 1,
- name: 'Half Stack application development',
+ const courses = [
+ {
+ name: 'Half Stack application development',
+ id: 1,
parts: [
{
- name: 'Fundamentals of React',
- exercises: 10,
- id: 1
+ name: 'Fundamentals of React',
+ exercises: 10,
+ id: 1
+
},
- {
- name: 'Using props to pass data',
- exercises: 7,
- id: 2
- },
- {
- name: 'State of a component',
- exercises: 14,
- id: 3
- }
+ {
+ name: 'Using props to pass data',
+ exercises: 7,
+ id: 2
+
+ },
+ {
+ name: 'State of a component',
+ exercises: 14,
+ id: 3
+
+ },
+ {
+ name: 'Redux',
+ exercises: 11,
+ id: 4
+
+ }
+
]
- }
-
- return <Course course={course} />
+
+ },
+ {
+ name: 'Node.js',
+ id: 2,
+ parts: [
+ {
+ name: 'Routing',
+ exercises: 3,
+ id: 1
+
+ },
+ {
+ name: 'Middlewares',
+ exercises: 7,
+ id: 2
+
+ }
+
+ ]
+
+ }
+
+ ]
+
+ return (<>{courses.map( (course) => {
+ return <Course course={course} />
+ } )
+ }</>)
}
export default App