pinia-plugin-persistedstate-2

March 8, 2025 ยท View on GitHub

Persist and rehydrate your Pinia state between page reloads.

CI NPM version

Features

  • ๐ŸŽจ Configurable globally and in every store.
  • ๐Ÿ’ช Type Safe
  • ๐Ÿ“ฆ Extremely small

๐Ÿš€ Getting Started

Installation

# or pnpm or yarn
npm install pinia-plugin-persistedstate-2

Usage

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createPersistedStatePlugin } from 'pinia-plugin-persistedstate-2'
import App from './App.vue'

const pinia = createPinia()

const persistedStatePlugin = createPersistedStatePlugin({
  // plugin options goes here
})
pinia.use(persistedStatePlugin)

const app = createApp(App)
app.use(pinia)
app.mount('#app')

More examples can be found in the examples folder.

API can be found in the type file.

๐Ÿค Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details