Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
State Management with Apollo GraphQL
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
adamTrz
August 27, 2018
Programming
52
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
State Management with Apollo GraphQL
Manage your Application State with Apollo GraphQL without a hassle.
adamTrz
August 27, 2018
Other Decks in Programming
See All in Programming
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
300
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
560
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
190
5分で問診!Composer セキュリティ健康診断
codmoninc
0
770
Build-to-own AI: Agentic Development for Humans
inesmontani
PRO
0
160
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
What's New in Android 2026
veronikapj
0
240
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
0
1k
テーブルをDELETEした
yuzneri
0
130
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
170
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
570
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
290
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
380
Crafting Experiences
bethany
1
230
It's Worth the Effort
3n
188
29k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
190
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
Building Adaptive Systems
keathley
44
3.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
340
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
460
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Transcript
State Management with Apollo GraphQL Adam Trzciński github.com/adamTrz medium.com/@adamtrzciski
What is State? •Data that comes from external APIs •Temporary
data •User selections !2
Redux or Mobx?
• Declarative data fetching • Apollo’s Higher Order Components
apollo-link-state • what are links? • what is apollo-link-state?
... import ApolloClient from 'apollo-boost'; ... const client = new
ApolloClient({ uri, clientState, }); Set up
const clientState = { defaults: { cart: [], }, resolvers:
{ Mutation: { addItemToCart: (_, { id, value }, { cache }) => { const previous = cache.readQuery({ query: CART_QUERY }); const data = {...}; cache.writeData({ data }); return null; }, ... Set up
export const CART_QUERY = gql` query GetCart { cart @client
{ id value } } `; export const ADD_ITEM_TO_CART = gql` mutation addItemToCart($id: ID!, $value: number!) { addItemToCart(id: $id, value: $value) @client } `; Usage
Demo Time!
Take away • One source of truth • Reduced code
boilerplate
Useful links • The Future of State Management by Peggy
Razis http://bit.ly/apollo_medium • Apollo-link-state - Let’s manage state with queries http://bit.ly/apollo_yt • Docs! http://bit.ly/apollo_docs
Thank you!