const allTeamApplicants = gql`
query ($id: ID!) {
allApplicants(filter: { user: { id: $id } }) {
id
firstName
lastName
appliedPosition
applicationStage
isFormFilled
isContractSigned
email
phoneNumber
}
I use Apollo Client for GraphQL in React web app. Anyone knows how to invoke a query with parameters in an event, for example, I want to trigger the query with a parameter when a user clicks a button.
To call a query in an event, instead of as in a higher order component, you should:
Import withApollo Hoc
Wrap your component with
withApollo
Inside your component, you will receive a new prop called
client
and you can use it as a Promise, such as:more info here: https://www.apollographql.com/docs/react/api/react-apollo.html#withApollo