To trigger a request in an event, and not as in a higher order component, you should:
Import using Apollo Hoc
import { withApollo } from 'react-apollo';
Wrap your component with withApollo
const component = withApollo(Component)
Inside your component, you will get a new icon called client, and you can use it as a promise, for example:
function eventHandler(idParam) {
client.query({
query: gql`
query ($id: ID!) {
allApplicants(filter: { user: { id: $id } }) {
id
firstName
lastName
appliedPosition
applicationStage
isFormFilled
isContractSigned
email
phoneNumber
}
}`,
variables: {
// set the variables defined in the query, in this case: query($id: ID!)
id: idParam
}
}
})
.then(...)
.catch(...)
}
: http://dev.apollodata.com/react/api-graphql.html#withApoll o