import React, { Component } from 'react'; import { graphql } from 'react-apollo'; import { Link } from 'react-router-dom'; import ServicesQuery from '@graphql/Services.gql'; class ServiceList extends Component { render() { const { location, services, loading, error } = this.props; const serviceList = loading ?

Loading...

: error ?

Error!!!

: services.map((service, index) =>

{service.name}

); return (

Service List

{ serviceList }
); } } const ServiceListWithData = graphql(ServicesQuery, { options(props) { return { variables: { deploymentGroupSlug: props.match.params.deploymentGroup } } }, props: ({ data: { deploymentGroup, loading, error }}) => ({ services: deploymentGroup ? deploymentGroup.services : null, loading, error }) })(ServiceList); export default ServiceListWithData;