Skip to content

Instantly share code, notes, and snippets.

@lomse
Created October 20, 2018 15:17
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 lomse/4f3893c0dd6f16827c6809ee4312b01d to your computer and use it in GitHub Desktop.
Save lomse/4f3893c0dd6f16827c6809ee4312b01d to your computer and use it in GitHub Desktop.
TodoList component
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