Exercise 1.4
This commit is contained in:
parent
5b11be3a96
commit
565f86e6fd
|
@ -8,36 +8,38 @@ const Part = (props) => (
|
|||
|
||||
const Content = (props) => (
|
||||
<div>
|
||||
<Part part={props.part1.name} exercise={props.part1.exercises} />
|
||||
<Part part={props.part2.name} exercise={props.part2.exercises} />
|
||||
<Part part={props.part3.name} exercise={props.part3.exercises} />
|
||||
<Part part={props.parts[0].name} exercise={props.parts[0].exercises} />
|
||||
<Part part={props.parts[1].name} exercise={props.parts[1].exercises} />
|
||||
<Part part={props.parts[2].name} exercise={props.parts[2].exercises} />
|
||||
</div>
|
||||
)
|
||||
|
||||
const Total = (props) => (
|
||||
<p>Number of exercises {props.total}</p>
|
||||
<p>Number of exercises {props.parts[0].exercises + props.parts[1].exercises + props.parts[2].exercises}</p>
|
||||
)
|
||||
|
||||
const App = () => {
|
||||
const course = 'Half Stack application development'
|
||||
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 = [
|
||||
{
|
||||
name: 'Fundamentals of React',
|
||||
exercises: 10
|
||||
},
|
||||
{
|
||||
name: 'Using props to pass data',
|
||||
exercises: 7
|
||||
},
|
||||
{
|
||||
name: 'State of a component',
|
||||
exercises: 14
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header course={course} />
|
||||
<Content part1={part1} part2={part2} part3={part3}/>
|
||||
<Total total={part1.exercises + part2.exercises + part3.exercises} />
|
||||
<Content parts={parts}/>
|
||||
<Total total={parts} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue