Created
October 20, 2018 15:17
-
-
Save lomse/4f3893c0dd6f16827c6809ee4312b01d to your computer and use it in GitHub Desktop.
TodoList 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
import React from "react" | |
import styled from "styled-components" | |
import PropTypes from "prop-types" | |
import TodoItem from "./TodoItem" | |
const StyledUl = styled.ul` | |
padding: 0; | |
` | |
const TodoList = props => { | |
const { todos } = props | |
const content = todos.map(todo => <TodoItem key={todo.id} id={todo.id} title={todo.name} />) | |
return <StyledUl>{content}</StyledUl> | |
} | |
TodoList.defaultProps = { | |
todos: [] | |
} | |
TodoList.propTypes = { | |
todos: PropTypes.arrayOf(PropTypes.object) | |
} | |
export default TodoList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment