import React from 'react'; import { browserHistory } from 'react-router'; import { ListGroup, ListGroupItem, Alert } from 'react-bootstrap'; const handleNav = (_id) => { browserHistory.push(`/documents/${_id}`); } const DocumentsList = ({ documents }) => ( documents.length > 0 ? {documents.map(({ _id, title }) => ( handleNav(_id) }> { title } ))} : No documents yet. ); DocumentsList.propTypes = { documents: React.PropTypes.array, }; export default DocumentsList;