Created
September 23, 2016 03:37
-
-
Save ManuelDeLeon/f8aa39164505d8820b264365c25b5578 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, { 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