Skip to content

Instantly share code, notes, and snippets.

@IlkhamGaysin
Created March 17, 2017 08:43
Show Gist options
  • Save IlkhamGaysin/25b255f20870adbf13d02797935c7252 to your computer and use it in GitHub Desktop.
Save IlkhamGaysin/25b255f20870adbf13d02797935c7252 to your computer and use it in GitHub Desktop.
import React, { Component, PropTypes } from 'react';
import { ListGroup } from 'react-bootstrap';
import Todo from 'components/todo';

export default class TodoList extends Component {
  static propTypes = {
    todos: PropTypes.arrayOf(
      PropTypes.shape({
        id: PropTypes.number,
        isComplete: PropTypes.bool,
        name: PropTypes.string
      })
    )
  }

  renderItems = () => {
    return this.props.todos.map(todo => <Todo key={ todo.id } todo={ todo }/>);
  }

  render() {
    return(
      <ListGroup>
        { this.renderItems() }
      </ListGroup>
    );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment