Open History to see the last commit
1import { Store } from '@tanstack/vue-store'
2β
3// You can instantiate a Store outside of Vue components too!
4export const store = new Store({
5 dogs: 0,
6 cats: 0,
7})
8β
9export function updateState(animal: 'dogs' | 'cats') {
10 store.setState((state) => {
11 return {
12 ...state,
13 [animal]: state[animal] + 1,
14 }
15 })
16}