Created
June 22, 2022 13:15
-
-
Save jogilvyt/84f4e1eaa506f9aa558e60a272e39dc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const ToDoList = ({ items }) => { | |
return ( | |
<div> | |
<ul> | |
{items.length && items.map(item => <li key={item.id}>{item.text}</li>)} | |
</ul> | |
</div> | |
); | |
}; | |
const App = () => { | |
return ( | |
<div> | |
<h2>Today:</h2> | |
<ToDoList | |
items={[ | |
{ id: 1, text: "Water the plants" }, | |
{ id: 2, text: "Wash the car" }, | |
{ id: 3, text: "Empty the bins" }, | |
]} | |
/> | |
<h2>Tomorrow:</h2> | |
<ToDoList items={[]} /> | |
</div> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment