Ad
How To Manually Fire Multiple Queries In Apollo-client?
I am trying to manually fire multiple queries, similarly to refetchQueries
that is available after a mutation.
this.props.client.query(
{
query: getPlacesForDateQuery
},
{
query: getTimesQuery
}
)
This works only for the 1st query and it ignores the others. I am wondering if there is a way to do it, other than manually firing each query separately and waiting for it to complete.
Note: I don't know if it matters, but I am not using the new Query
component.
Ad
Answer
Check out this helpful article
I think your syntax is slightly off. You can compose multiple queries into one. This is your mistake here. Try it like so:
query ___composed {
author {
firstName
lastName
}
fortuneCookie
}
or you can write two queries like so:
query firstQuery {
author {
firstName
lastName
}
}
query secondQuery {
fortuneCookie
}
Ad
source: stackoverflow.com
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?
Ad