I am using a watchQuery or query in Apollo-Angular (graphql)
How is the logic and difference of the watchQuery and query
watchQuery is something you constantly keep a watch on query, whenever that query will be refetched or the data related to that query is changed from anywhere else, this method will keep on emitting the updated data. It's really simple, you can read the docs here. Follow this answer to receive notifications.
A GraphQL query is used to read or fetch values while a mutation is used to write or post values. In either case, the operation is a simple string that a GraphQL server can parse and respond to with data in a specific format. The popular response format that is usually used for mobile and web applications is JSON.
GraphQL and Apollo help you ship features fasterA backend that serves data to clients from multiple sources (Postgres, Redis, etc.) Complex state and cache management for both the frontend and the backend.
Apollo Boost is a zero-config way to start using Apollo Client. It includes some sensible defaults, such as our recommended InMemoryCache and HttpLink , which come configured for you with our recommended settings.
query
is something you just query for once, you can consider it as an equivalent of GET.
watchQuery
is something you constantly keep a watch on query, whenever that query will be refetched or the data related to that query is changed from anywhere else, this method will keep on emitting the updated data.
It's really simple, you can read the docs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With