All quizzesMedium
Store Composition
Preview — 3 of 10 questions
What is the difference between Options syntax and Setup syntax for defineStore?
ASetup stores use a function returning reactive state/computed/methods — similar to <script setup> — giving more flexibility and better TypeScript inference
BSetup stores are only available in Vue 3.3+; Options stores work in Vue 2 and 3
COptions stores support SSR while Setup stores do not
DSetup stores cannot have actions — only computed properties
How do you create a Pinia plugin?
ACall pinia.use() with a function that receives { pinia, app, store, options }
BExtend the PiniaPlugin class and register it with app.use
CDefine a plugin in the store options using plugins: [myPlugin]
DUse createPinia({ plugins: [myPlugin] })
What is the correct way to configure pinia-plugin-persistedstate for selective persistence?
ASet persist: true in the store — all state is persisted automatically
BCall store.$persist() manually after state changes
CUse the persist option in defineStore with granular configuration for paths, storage, and serialization
DConfigure persistence in createPinia({ persist: { ... } })
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.