hello , I used to work with Vuex , now I am starting to work with Pinia . I have a question .
Can I use the same name for State and Getter in Pinia ? I used to do this in VUEX for some state that I want to pass some extra value to it .
for example , I have a State that is called products , and I have a initial value that I store when my page is created .
In VUEX -
// initial values is in case that you want to reset thouse values for initial values
state -
products: {value: [], initial_values:[] }
Getter -
products: state => {
return products.value
}
// list products -
{{ products }}
...mapGetters('products', {
products: 'products'
})
In PInia -
state -
products: {value: [], initial_values:[] }
Getter -
productsValue: state => {
return products.value
}
// list products -
{{ storeProduct.productsValue }}
import {useProductStore} from "stores/admin/products"
const storeProduct = useProductStore()
if in pinia I have the same state with the same name like this , it will not be possible , I must change the name -
state -
products: {value: [], initial_values:[] }
Getter -
products: state => {
return products.value
}
// list products -
{{ storeProduct.products }}
import {useProductStore} from "stores/admin/products"
const storeProduct = useProductStore()
does have any way to do some thing like this in Pinia ?
to shows that I am reffering to a Getter and not to a State something like this ?
// list products -
{{ storeProduct.getters.products }}