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.4k
1
Share
You Might Not Need Vuex
A few alternatives to Vuex state management in Vue application
Natalia Tepluhina
February 21, 2020
More Decks by Natalia Tepluhina
See All by Natalia Tepluhina
All you need is Apollo Client
ntepluhina
0
330
How to build beautiful Vuesualizations
ntepluhina
0
97
Other Decks in Programming
See All in Programming
Sans tests, vos agents ne sont pas fiables
nabondance
0
160
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
3
1.2k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
370
OSもどきOS
arkw
0
250
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
170
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.1k
3Dシーンの圧縮
fadis
1
430
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
390
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
200
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
2
280
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
1.2k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
390
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Mobile First: as difficult as doing things right
swwweet
225
10k
The Curious Case for Waylosing
cassininazir
1
360
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
200
Navigating Team Friction
lara
192
16k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
A Tale of Four Properties
chriscoyier
163
24k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Raft: Consensus for Rubyists
vanstee
141
7.5k
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