Open uniquedj95 opened 2 years ago
Use the namespaced helper twice.
will that not conflict each other. for instance,
const { useState} = createNamespacedHelper('moduleA')
const { useState} = createNamespacedHelper('moduleB')
so when I call useState()
which one am I calling/invoking?
In JS you can choose between:
const { a as b } = getB() const { a as x } = getX()
Or
const a = getB().a; const b = getX().a;
Or
const mapperA = getMapper("a") const mapperB = getMapper("b") ... mappperA.useGetters(["a"])
Choose your favorite.
Would be nice to have "in-place" namespaces, similar to what happens with vuex
mappers.
import { useGetters } from 'vuex-composition-helpers'
export default {
setup() {
const { one, two } = useGetters('my/long/name/space', ['one', 'two'])
const { uno, dos } = useGetters('my/other/thing', ['uno', 'dos'])
return { one, two, uno, dos }
}
}
@nolde as you can see in the source code, the global functions are passing null
as a namespace to the useMapping
function.
If you like to create an improvement that will pass the namespace to the global functions, you're welcome, just make sure all the tests will pass :)
How can I use multiple namespaced helpers in a single component?