Skip to content

Instantly share code, notes, and snippets.

@ManuelDeLeon
Created September 23, 2016 03:37
Show Gist options
  • Save ManuelDeLeon/f8aa39164505d8820b264365c25b5578 to your computer and use it in GitHub Desktop.
Save ManuelDeLeon/f8aa39164505d8820b264365c25b5578 to your computer and use it in GitHub Desktop.
import React, { PropTypes } from 'react'
import Todo from './Todo'
const TodoList = ({ todos, onTodoClick }) => (
<ul>
{todos.map(todo =>
<Todo
key={todo.id}
{...todo}
onClick={() => onTodoClick(todo.id)}
/>
)}
</ul>
)
TodoList.propTypes = {
todos: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number.isRequired,
completed: PropTypes.bool.isRequired,
text: PropTypes.string.isRequired
}).isRequired).isRequired,
onTodoClick: PropTypes.func.isRequired
}
export default TodoList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment