Created
November 11, 2017 17:16
-
-
Save eddyw/d231ac6c28aed4fce1eb52156810ba78 to your computer and use it in GitHub Desktop.
Map Component
This file contains hidden or 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
const completedStyle = { color: 'green' } | |
const uncompletedStyle = { color: 'red' } | |
const Item = ({ title, completed }) => ( | |
<li> | |
<span>{completed ? 'o' : 'x'} </span> | |
<span style={completed ? completedStyle : uncompletedStyle}>{title}</span> | |
</li> | |
) | |
const TodoList = () => ( | |
<ul> | |
<MapArray from={todoList}> | |
<Item /> | |
</MapArray> | |
</ul> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment