mirror of
https://github.com/10h30/fullstackopen.git
synced 2026-06-05 15:08:33 +09:00
Completed 2.4
This commit is contained in:
+50
-28
@@ -1,34 +1,56 @@
|
||||
import React from 'react'
|
||||
|
||||
const App = () => {
|
||||
const course = {
|
||||
id: 1,
|
||||
name: 'Half Stack application development',
|
||||
parts: [
|
||||
{
|
||||
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: 'Redux',
|
||||
exercises: 11,
|
||||
id: 4
|
||||
}
|
||||
]
|
||||
}
|
||||
const courses = [
|
||||
{
|
||||
name: 'Half Stack application development',
|
||||
id: 1,
|
||||
parts: [
|
||||
{
|
||||
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: 'Redux',
|
||||
exercises: 11,
|
||||
id: 4
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Node.js',
|
||||
id: 2,
|
||||
parts: [
|
||||
{
|
||||
name: 'Routing',
|
||||
exercises: 3,
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
name: 'Middlewares',
|
||||
exercises: 7,
|
||||
id: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
return <Course course={course} />
|
||||
return (
|
||||
<div><h1>Web Development Curriculum</h1>
|
||||
{courses.map(course => <Course key={course.id} course={course} />)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Course = ({course}) => {
|
||||
@@ -43,7 +65,7 @@ const Course = ({course}) => {
|
||||
|
||||
const Header = (props) => {
|
||||
return (
|
||||
<h1>{props.course.name}</h1>
|
||||
<h2>{props.course.name}</h2>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user