refactored
This commit is contained in:
parent
1d48e78d7f
commit
3864c11b9b
4 changed files with 35 additions and 23 deletions
|
|
@ -1,26 +1,5 @@
|
|||
const Header = (props) => {
|
||||
return <h1>{props.course}</h1>;
|
||||
};
|
||||
|
||||
const Part = (props) => {
|
||||
return (
|
||||
<p>
|
||||
{props.partName} {props.exerciseCount}
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
const Content = (props) => {
|
||||
return (
|
||||
<>
|
||||
{props.sections.map((section) => {
|
||||
return (
|
||||
<Part partName={section.part} exerciseCount={section.exerciseCount} />
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
import Header from "./components/Header";
|
||||
import Content from "./components/Content";
|
||||
|
||||
const App = () => {
|
||||
const course = {
|
||||
|
|
@ -38,6 +17,10 @@ const App = () => {
|
|||
part: "State of a component",
|
||||
exerciseCount: 14,
|
||||
},
|
||||
{
|
||||
part: "An extra part I added just like that",
|
||||
exerciseCount: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue