Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vue 3.0 Composition API を利用した Store と Composabl...
Search
Toru Eguchi
December 11, 2019
Technology
5k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vue 3.0 Composition API を利用した Store と Composables の違い
Toru Eguchi
December 11, 2019
More Decks by Toru Eguchi
See All by Toru Eguchi
デザインシステムを中心とした AI 開発支援と Generative UI の取り組み
egurinko
1
340
Vue 3.0 Composition API に触ってみた
egurinko
3
2k
このタイミングで Vue.js に TypeScript を導入するには?
egurinko
1
2k
How to start making a VR application with Unity
egurinko
0
69
Other Decks in Technology
See All in Technology
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
280
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
1.1k
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
210
hackers_champloo_2026_tidb
makocchi
0
160
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
140
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
Kiro Crewをはじめよう
kizawa2020
1
160
Classmethod Company Deck
satoshi7
1
660
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
1
860
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
170
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
First, design no harm
axbom
PRO
2
1.3k
Test your architecture with Archunit
thirion
2
2.4k
Faster Mobile Websites
deanohume
310
32k
Utilizing Notion as your number one productivity tool
mfonobong
4
620
Skip the Path - Find Your Career Trail
mkilby
1
260
Transcript
Vue 3.0 Composition API を利用した Store と Composables の違い 江口 徹(@egurinko)
Vue.js for 2020
• 大学 VR × 高齢者で研究 • 新卒で某通信会社 インフラ担当 • Code
Chrysalis という BootCamp を3ヶ月 • 某通信会社復帰 SIer としてフロント開発 • ギフティ入社半年 @egurinko (江口 徹)
お話しすること 01 02 03 04 Vue3.0 の疑問 Composition API の紹介
疑問解決への きっかけ まとめ
巷では、 • Composition API で 状態管理が出来るよう になる? 疑問の始まり
疑問の始まり LinusBorg 氏の demo を見ると、 同じ Composition API を利用した composables
と store が 存在する
どうやら、Composition API には、2 つの使い方がある この違いは一体なんなんだろう?
ということで、 試して、 探ってみた https://what-is-todays-dinner.herokuapp.com
https://what-is-todays-dinner.herokuapp.com ある特定の機能の Composition API の紹介
https://what-is-todays-dinner.herokuapp.com ある特定の機能の • 状態 Composition API の紹介
https://what-is-todays-dinner.herokuapp.com ある特定の機能の • 状態 • 振る舞い をモジュール化させるた めのAPI Composition API
の紹介
https://what-is-todays-dinner.herokuapp.com Composition API を利用する側 インポートして、関数を呼び出すだけ 各所で 使い回せば Store になる!
https://what-is-todays-dinner.herokuapp.com ますます、 Composables と Store の 違いがわからなくなっていた
ローダの機能をモジュール化した useLoader の composition function を実装した しかし、あるコンポーネントで Loader の State
を 変更しても、 Loader が回らない https://what-is-todays-dinner.herokuapp.com 違いに気づいたきっかけ
- App.vue - Recipes.vue - Loader.vue https://what-is-todays-dinner.herokuapp.com 原因 コンポーネントツリー useLoader()
で state の変更 useLoader() で state を参照
- App.vue - Recipes.vue - Loader.vue https://what-is-todays-dinner.herokuapp.com 原因 コンポーネントツリー useLoader()
で state の変更 useLoader() で state を参照 それぞれのスコープがグローバルではなかった・・・
https://what-is-todays-dinner.herokuapp.com 単純に作成した composition function のスコープは、 グローバルではない
https://what-is-todays-dinner.herokuapp.com 良く確認したら、 Linus さんの demo では、 Store として利用したい項目は provide でグローバルスコープへ
inject を利用して各コンポーネントで 利用するようになっていた store/ 配下
https://what-is-todays-dinner.herokuapp.com つまり、composables と store の境界とは グローバルで参照するべきものは、 composition api と provide/inject
を利用して store へ、 グローバルで必要のない状態や振る舞いは、 composables へ
https://what-is-todays-dinner.herokuapp.com 考えてみたら、 Store はグローバルで状態を管理したい って当たり前だよね
https://what-is-todays-dinner.herokuapp.com