Skip to content
masterclass Buddy

Vue.js · Function

defineStore

defineStore creates a function for retrieving a Pinia store. Give it a unique id and define the store with either options or a setup function.

Last updated

Syntax

function defineStore<Id, S, G, A>(id, options): StoreDefinition<Id, S, G, A>
function defineStore<Id, SS>(id, storeSetup, options?): SetupStoreDefinition<Id, SS>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • StoreDefinition
  • SetupStoreDefinition
  • storeToRefs
  • mapState
  • mapActions
  • mapStores

Source: defineStore() | Pinia. Checked 2026-11-03.