import React from 'react'; import { compose } from 'react-apollo'; import styled from 'styled-components'; import Pagination from './Pagination'; import Item from './Item'; import { itemEnhancer } from '../enhancers/enhancers'; const Items = styled.div` display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); grid-gap: 60px; max-width: ${props => props.theme.maxWidth}; margin: 0 auto; `; const Center = styled.div` text-align: center; `; class ItemList extends React.Component { something() {} render() { const { loading, error } = this.props.itemsQuery; // 1 if (loading) { return
Loading
; } // 2 if (error) { console.log(this.props.itemsQuery.error); return
Error
; } // 3 const itemsToRender = this.props.itemsQuery.items; return (
{itemsToRender.map((item, i) => )}
); } } export default compose(itemEnhancer)(ItemList);