Skip to content

Instantly share code, notes, and snippets.

@eddyw
Created November 11, 2017 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyw/3ad6fbc15a2a029ebb03e969eef7f0c6 to your computer and use it in GitHub Desktop.
Save eddyw/3ad6fbc15a2a029ebb03e969eef7f0c6 to your computer and use it in GitHub Desktop.
Map Component
const completedStyle = { color: 'green' }
const uncompletedStyle = { color: 'red' }
const TodoList = () => (
<ul>
{todoList.map(({ title, completed }, key) => (
<li key={key}>
<span>{completed ? 'o' : 'x'} </span>
<span style={completed ? completedStyle : uncompletedStyle}>{title}</span>
</li>
))}
</ul>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment