You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not trying to offend, trying to understand do we really need a state management library for Vue 3?
I mean, the example code in the first page:
import{createStore}from'pinia'exportconstuseMainStore=createStore({// name of the store// it is used in devtools and allows restoring stateid: 'main',// a function that returns a fresh statestate: ()=>({counter: 0,name: 'Eduardo',}),// optional gettersgetters: {doubleCount: (state,getters)=>state.counter*2,// use getters in other gettersdoubleCountPlusOne: (state,{ doubleCount })=>doubleCount.value*2,},// optional actionsactions: {reset(){// `this` is the store instancethis.state.counter=0},},})
Not trying to offend, trying to understand do we really need a state management library for Vue 3?
I mean, the example code in the first page:
Can be replaced with:
and it will work mostly the same.
Are there any advantages for pinia over the example I attached ?
The text was updated successfully, but these errors were encountered: