Pinia Documentation

website·Indexed 29 days ago

https://variesd-spring.netlify.app/

Documentation for Pinia, featuring guides on defining stores using the defineStore function for Vue.js applications.

Tokens
123
Snippets
1
Records
1
Agent score
25%

What's inside Pinia

  1. Define a Pinia store using defineStore

    Use the defineStore function from the pinia package to create a store. The function takes two arguments: a unique string ID for the store (used across the application) and an options object. It is a convention to name the exported store constant using the use...Store pattern (e.g., useAlertsStore).
    import { defineStore } from 'pinia'
    
    // 'alerts' is the unique id of the store
    export const useAlertsStore = defineStore('alerts', {
      // state, getters, and actions go here
    })