GraphQLのクライアントライブラリを使うのはキャッシュのため
スキーマとデータの一致
要求したデータをクライアントが望んだ形で受け取れる
リクエストは1回でいい
GraphQLのクライアントを使う理由はキャッシュをうまく処理してくれるから
GraphQLではHTTPのキャッシュの仕組みは使えない
Modern client applications use caching extensively to improve performance and user experience. And generic HTTP caching just doesn’t work with GraphQL. Every time you request even slightly different data, your HTTP-cached value is invalidated, making it useless for an application of any complexity.
GraphQL data is inherently, well, graphical. And to support GraphQL data effectively, a cache needs to reflect that graphical structure. HTTP caching can’t do this, but a library like Apollo Client can. In our opinion, this is the most important functionality that a GraphQL client library can provide.
クエリが違っても、すでにあるデータをキャッシュから読み取れる
It’s because of the cache-focused philosophy behind Apollo Client that we don’t think of it primarily as a library for executing GraphQL operations, but rather as a library for interacting with a client-side data graph