Complete the code to import the function needed to create a Pinia store.
import { [1] } from 'pinia';
The defineStore function is used to create a Pinia store.
Complete the code to define a Pinia store named 'counter'.
export const useCounterStore = defineStore('[1]', { state: () => ({ count: 0 }) });
The first argument to defineStore is the unique store id, here 'counter'.
Fix the error in the store's state definition by completing the code.
state: () => [1]The state must return an object, so use curly braces {} with properties inside.
Fill both blanks to add an action named 'increment' that increases count by 1.
actions: {
increment() {
this.[1] [2] 1;
}
}The action modifies the count property by adding 1 using +=.
Fill all three blanks to add a getter named 'doubleCount' that returns count multiplied by 2.
getters: {
doubleCount(state) {
return state.[1] [2] [3];
}
}The getter returns state.count * 2 to double the count value.
