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
You Might Not Need Vuex
Search
Natalia Tepluhina
February 21, 2020
Programming
1
1.2k
You Might Not Need Vuex
A few alternatives to Vuex state management in Vue application
Natalia Tepluhina
February 21, 2020
Tweet
Share
More Decks by Natalia Tepluhina
See All by Natalia Tepluhina
All you need is Apollo Client
ntepluhina
0
310
How to build beautiful Vuesualizations
ntepluhina
0
75
Other Decks in Programming
See All in Programming
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Quine, Polyglot, 良いコード
qnighy
4
650
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
距離関数を極める! / SESSIONS 2024
gam0022
0
290
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
RubyLSPのマルチバイト文字対応
notfounds
0
120
Featured
See All Featured
Embracing the Ebb and Flow
colly
84
4.5k
The Invisible Side of Design
smashingmag
298
50k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Unsuck your backbone
ammeep
668
57k
Code Review Best Practice
trishagee
64
17k
Fireside Chat
paigeccino
34
3k
GitHub's CSS Performance
jonrohan
1030
460k
Documentation Writing (for coders)
carmenintech
65
4.4k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
YOU MIGHT NOT NEED VUEX
YOU MIGHT NOT NEED VUE
Core Team Member My name is Natalia Tepluhina Google Developer
Expert Senior Frontend Engineer @N_Tepluhina
Do I need a shared state?
“ “Flux libraries are like glasses: you'll know when you
need them” Dan Abramov
Independent components Different routes Deep nesting
Provide/inject approach
Provide Inject
Reactive object
Don’t change data where it’s injected!
Composition API to the rescue
posva/pinia Automatically typed, modular and lightweight store for Vue using
the Composition api with DevTools support Eduardo San Martin Morote
Creating a store
Using a store in components
DEMO
Let’s get some GraphQL hype!
vue-apollo Integrates Apollo in your Vue components with declarative queries.
Compatible with Vue 2.0+ and 3.0+. Guillaume Chau
Dispatch an action Trigger API call Success? Commit ‘success’ mutation
State changed Commit ‘error’ mutation Yes No
None
Query Success/error State changed
Ok but what about local state?
Local state* = Apollo Cache *everything is Apollo Cache
‘Normal’ query…
..vs local query
Setting initial state
Changing data
Read the cache Update data Write back to the cache
DEMO
Thanks! You can find demo repository at bit.ly/no-vuex