> Pinia State Management

Vue 3 state management with Pinia stores, getters, actions, and persistence.

fetch
$curl "https://skillshub.wtf/skillshub-team/catalog-batch5/pinia-state?format=md"
SKILL.mdPinia State Management

Pinia

Store

import { defineStore } from 'pinia';
export const useAuthStore = defineStore('auth', () => {
    const user = ref<User | null>(null);
    const isLoggedIn = computed(() => !!user.value);
    async function login(email: string, pass: string) {
        user.value = await api.login(email, pass);
    }
    return { user, isLoggedIn, login };
});

Usage

<script setup>
const auth = useAuthStore();
const { isLoggedIn } = storeToRefs(auth);
</script>

Persistence: pinia-plugin-persistedstate for localStorage sync

┌ stats

installs/wk0
░░░░░░░░░░
first seenMar 18, 2026
└────────────

┌ tags

└────────────