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'
|
import React from 'react'
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const course = {
|
const courses = [
|
||||||
id: 1,
|
{
|
||||||
name: 'Half Stack application development',
|
name: 'Half Stack application development',
|
||||||
parts: [
|
id: 1,
|
||||||
{
|
parts: [
|
||||||
name: 'Fundamentals of React',
|
{
|
||||||
exercises: 10,
|
name: 'Fundamentals of React',
|
||||||
id: 1
|
exercises: 10,
|
||||||
},
|
id: 1
|
||||||
{
|
},
|
||||||
name: 'Using props to pass data',
|
{
|
||||||
exercises: 7,
|
name: 'Using props to pass data',
|
||||||
id: 2
|
exercises: 7,
|
||||||
},
|
id: 2
|
||||||
{
|
},
|
||||||
name: 'State of a component',
|
{
|
||||||
exercises: 14,
|
name: 'State of a component',
|
||||||
id: 3
|
exercises: 14,
|
||||||
},
|
id: 3
|
||||||
{
|
},
|
||||||
name: 'Redux',
|
{
|
||||||
exercises: 11,
|
name: 'Redux',
|
||||||
id: 4
|
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}) => {
|
const Course = ({course}) => {
|
||||||
@@ -43,7 +65,7 @@ const Course = ({course}) => {
|
|||||||
|
|
||||||
const Header = (props) => {
|
const Header = (props) => {
|
||||||
return (
|
return (
|
||||||
<h1>{props.course.name}</h1>
|
<h2>{props.course.name}</h2>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user