Open ghost opened 6 years ago
It appears that there is no way (judjing by code): https://github.com/ktsn/vuex-connect/blob/master/src/connect.js#L81
mapX
functions are executed with only one argument (without namespace).
@ktsn is there any particular reason you chose not to forward namespace through your connect
function? If there isn't, would you be open to accepting a pull request with this functionality?
feel free to make a PR.
@ktsn Made a PR, is this solution adequate?
export default connect({
stateToProps: (mapState) => ({
...mapState('someNestedStore', {
nestedMessage: 'message',
}),
...mapState({
message: 'message',
})
}),
gettersToProps: (mapGetters) => ({
...mapGetters('someNestedStore', {
messageNestedGetter: 'inputMessageGetter'
}),
...mapGetters({
messageGetter: 'inputMessageGetter'
}),
})
})('hello', HelloComponent)
(Edit: fixed example, demonstrates that you can use both mapGetters and mapState as well as with/without namespace)
Also interested in proper solution
I would like to know how to apply connect
to regular component with and Githubissues.
How do I use StateToProps with state in namespace? Thanks