Pinia standalone? #1183
-
I know it's possible to use Pinia outside of a Vue project by actually adding vue (either v2 or v3) and creating an App solely for the purpose of starting the store (e.g: reactivue, Using pinia standalone). Is there any plan to publish pinia really stand-alone (with a minimal list of dependencies handled internally - e.g: reactivity). It would allow companies to encapsulate business logic in stores and use them across multiple frameworks, which no other state management plugin currently offers. It would be a huge selling point. What I'm saying is you can't currently convince large corporate companies to import Vue and instantiate an app just for using pinia. They perceive as too heavy and they don't care it's not. But they would be willing to try a new state management "plugin". |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
I would also love to use Pinia without depending on Vue app |
Beta Was this translation helpful? Give feedback.
-
I want to use Pinia on server side program without vue framework. import { createPinia, defineStore } from 'pinia'
const pinia = createPinia()
class Test {
private name: string
constructor(name: string) {
this.name = name
console.log(name)
}
run() {
console.log(`${this.name}: run`)
}
}
const useStore = defineStore('store', () => {
return new Test('store')
})
console.log('start')
const store = useStore()
store.run() |
Beta Was this translation helpful? Give feedback.
-
Agree, it should not be depended on Vue. I switched on a new project that uses React, and wanted to use Pinia for it but it's too sad that it's tightly coupled with Vue (even though from conceptual perspective it shouldn't be) |
Beta Was this translation helpful? Give feedback.
-
Plus, with this one, would be great to switch between UI frameworks and keep the state |
Beta Was this translation helpful? Give feedback.
-
I created |
Beta Was this translation helpful? Give feedback.
I created
pinia-core
package which replace thevue-demi
with@vue/runtime-core
and it actually works in React.https://github.com/toyobayashi/pinia-core