@tonyptang/store-helper
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published
// npm i @tonyptang/store-helper
// for vuex
import { useMapState } from '@tonyptang/store-helper/vuex'
const { state } = useMapState('moduleName', ['state'])

const { state } = useMapState('moduleName', ['state'], true)

state.value = 'changed'
// for pinia
import { useStoreToRefs } from '@tonyptang/store-helper/pinia'

const store = defineStore('id', () => {
  const count = ref(0)

  const increment = () => count.value++
  return {
    count,
    increment
  }
})

export const countStore = () => useStoreToRefs(store)

// usage

const { count, increment } = countStore()
console.log(count.value) // 0

Readme

Keywords

none

Package Sidebar

Install

npm i @tonyptang/store-helper

Weekly Downloads

3

Version

1.7.0

License

ISC

Unpacked Size

20.7 kB

Total Files

8

Last publish

Collaborators

  • tonyptang