Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use watchQuery or query in Apollo-Angular?

Tags:

I am using a watchQuery or query in Apollo-Angular (graphql)

How is the logic and difference of the watchQuery and query

like image 269
yussenn Avatar asked Apr 02 '18 20:04

yussenn


People also ask

What is watchQuery?

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.

What is query in GQL?

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.

Is Apollo GraphQL frontend or backend?

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.

What is Apollo boost?

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.


1 Answers

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.

like image 91
Manzur Khan Avatar answered Sep 17 '22 12:09

Manzur Khan