@apollo/client
GraphQL ClientのApollo
https://www.apollographql.com/docs/react/
#wip
フロントエンドでGraphQLクエリを送受信するためのApollo公式クライアント。キャッシュ管理なども提供。
#??
InmemoryCache
http://apollographql.com/docs/react
Introduction
Why Apollo Client?
Get started
Fetching
useQuery (apollo)
Suspense
Fragments
useMutation (apollo)
Refetching
Subscriptions
Directives
Error handling
Document transforms
Deferring response data
Best practices
Apollo ClientのCache
Pagination
https://www.apollographql.com/docs/react/pagination/overview
Overview
Core API
Offset-based
Cursor-based
keyArgs
Apllo ClientでLocal State管理
Development &Testing
Developer tools
Using TypeScript
Testing React components
Schema-driven testing
Mocking schema capabilities
Reducing bundle size
Performance
Improving performance
Optimistic mutation results
Server-side rendering
Compiling queries with Babel
Integrations
Using Apollo Client with your view layer
Integrating with React Native
Loading queries with Webpack
Networking
Basic HTTP networking
Advanced HTTP networking
Authentication
Migration
Migrating to Apollo Client 3.0
Hooks migration guide
ApI reference
Code
ApolloClient
InMemoryCache
ObservableQuery
React
Hooks
Preloading
Testing
SSR
Apollo Link
Overview
HTTP
HTTP Batch
Context
Error
Persisted Queries
Remove Typename
REST
Retry
Schema
Subscriptions (newer protocol)
WebSocket (older protocol)
Community links
query系
useQuery (apollo)
useLazyQuery (apollo)
useSuspenseQuery (apollo)
useBackgroundQuery (apollo)
useLoadableQuery (apollo)
ApolloProvider
useMutation (apollo)
useSubscription (apollo)
useFragment (apollo)
useApolloClient (apollo)
useReactiveVar (apollo)
useReadQuery (apollo)
useQueryRefHandlers (apollo)
skipToken (apollo)
createQueryPreloader
特徴
この特徴は他のGraphQL Clientとの比較であるmrsekut.icon
データの正規化構造を持っている
__typename fieldと id fieldをkeyにする
キャッシュ機構を組み込める
クエリを発行するとローカルのキャッシュに問い合わせ、データが無ければリモートのGraphQLサーバーに問い合わせを行う
リクエストしたデータがローカルに存在しているかどうか、ネットワーク上に取りに行く必要があるのかを気にすることなくデータへのアクセスを行うことが出来ます
ローカルのキャッシュへのアクセスもネットワーク越しでのデータアクセスも同様のクエリで実行します
Apollo Linkでrequestの前処理、後処理ができる
Local Stateも管理できる
各種環境向けに用意されている
JavaScript
React
react-apollo
Angular
Vue
Svelte
Ember
Meteor (thanks to DDP-Apollo)
Web Components
Apollo Elements
Native mobile
Native iOS with Swift
Native Android with Java and Kotlin
apollo-cache-inmemory
キャッシュを追加
apollo-link-http
エンドポイントを追加
リクエストをカスタマイズ
apollo-client
ミドルウェアをカスタマイズ
リンクをカスタマイズ
graphql-tag
graphqlのクエリをテンプレートリテラルで書ける
apollo-boost
graphqlのクライアントライブラリの一式
graphql-code-generator
https://buildersbox.corp-sansan.com/entry/2020/07/22/110000
https://www.npmjs.com/package/@apollo/react-hooks
rect hooks
https://github.com/tannerlinsley/react-query#queries
query系の集まり
Optimistic UI
https://www.apollographql.com/blog/reducing-our-redux-code-with-react-apollo-5091b9de9c2a/
Apollo Clientのケーススタディとして、メジャーリーグサッカーのアプリケーションでは5000行近くのReduxのコードを削除することに成功した事例が掲載されています。
https://speakerdeck.com/kobayang/apollo-client-cache
https://qiita.com/seya/items/26c8a0dc549a10efcdf8
https://speakerdeck.com/lightnet328/the-challenge-of-web-re-architecture-using-graphql-and-apollo?slide=15
https://tech.jxpress.net/entry/understand-apollo-cache
cache
https://qiita.com/seya/items/e1d8e77352239c4c4897