Skip to content
Source
Sign inSign up
TanStack/store
Open History to see the last commit

store.ts

16 lines328 Bytes

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 })