@vueblocks/vue-use-vuex
Use Vuex With Composition API Easily.
Install
yarn add @vue/composition-api @vueblocks/vue-use-vuex -S
or
npm i @vue/composition-api @vueblocks/vue-use-vuex -S
yarn add @vueblocks/vue-use-vuex -S
or
npm i @vueblocks/vue-use-vuex -S
Usage
useVuex
utilities just similar with Vuex Component Binding Helpers
It export these composable helpers:
Differently, useVuex
do not export createNamespacedHelpers
function, Instead useVuex
allow you provide
the namespace as first argument, then return will be the namespaced component binding helpers.
Read more about namespacing documention.
It seems familiar right?
Typing
declare function useVuex(namespace?: string, store?: Store<any>): {
useState: (namespace?: string, map: Array<string> | Object<string | function>) => Object<ComputedRef>
useGetters: (namespace?: string, map: Array<string> | Object<string>) => Object<ComputedRef>
useMutations: (namespace?: string, map: Array<string> | Object<string | function>) => Object
useActions: (namespace?: string, map: Array<string> | Object<string | function>) => Object
};