In the Apollo React docs <http://dev.apollodata.co...
# prisma-whats-new
t
In the Apollo React docs http://dev.apollodata.com/react/queries.html#basics there are examples of fetching automatically when the component is shown, but I'd like to run a query when a button is clicked. I see an example to "re"fetch a query when a button is clicked, but I don't want it to query initially. I see there is a way to call mutations, but how do you call queries?
n
@typaza Hey Salim! You can use the
withApollo
function and wrap it around your component. This will inject the
ApolloClient
into the component’s props which has a method called
query
that does exactly what you’re asking for here.
t
thanks ☺️