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
76
Other Decks in Programming
See All in Programming
楽しく向き合う例外対応
okutsu
0
130
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
ソフトウェアエンジニアの成長
masuda220
PRO
11
1.5k
Rails アプリ地図考 Flush Cut
makicamel
1
120
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
250
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.4k
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
130
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
120
GAEログのコスト削減
mot_techtalk
0
120
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
140
WebDriver BiDiとは何なのか
yotahada3
1
140
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
110
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
521
39k
Side Projects
sachag
452
42k
How STYLIGHT went responsive
nonsquared
98
5.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
550
Speed Design
sergeychernyshev
27
790
Adopting Sorbet at Scale
ufuk
74
9.2k
Unsuck your backbone
ammeep
669
57k
Being A Developer After 40
akosma
89
590k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Git: the NoSQL Database
bkeepers
PRO
427
64k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
A Philosophy of Restraint
colly
203
16k
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