import React, { Component } from 'react' import { Link } from 'react-router-dom' import { connect } from 'react-redux' import { Loader } from 'app/common' import actions from 'app/actions' import ProjectMenu from '../components/project.menu' // const { result, collectionLookup } = this.props class ProjectIndex extends Component { componentDidMount() { this.fetch() } fetch() { actions.project.index() } render() { const { loading, lookup, order } = this.props.project.index if (loading) { return ( ) } if (!lookup || !order.length) { return ( Projects {"No projects"} ) } return ( Projects {order.map(id => ( {lookup[id].title}{': '} {lookup[id].title} ))} {order.length >= 50 && this.fetch(true)}>Load More} ) } } const mapStateToProps = state => ({ project: state.project, }) export default connect(mapStateToProps)(ProjectIndex)
{"No projects"}