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
良いユニットテストを書こう
mototakatsu
8
2.8k
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
1
140
선언형 UI에서의 상태관리
l2hyunwoo
0
180
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
Security_for_introducing_eBPF
kentatada
0
110
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
Exploring: Partial and Independent Composables
blackbracken
0
100
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
160
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
230
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
400
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
480
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
6
1.4k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
A Tale of Four Properties
chriscoyier
157
23k
Being A Developer After 40
akosma
87
590k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Adopting Sorbet at Scale
ufuk
73
9.1k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Building Applications with DynamoDB
mza
91
6.1k
The Language of Interfaces
destraynor
154
24k
Speed Design
sergeychernyshev
25
670
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