Skip to content

Working Vuex - Suggestion?? #61

Closed
Closed
@aaronksaunders

Description

@aaronksaunders

First off... looks great!!

In the example you are using mapActions, but not mapState

message () {
  return `Counter: ${this.$store.state.counter.count}`;
},
surprise () {
  return (this.$store.state.counter.count >= 5);
},

vs

...mapState({
  message: state => `Counter: ${state.counter.count}`,
  surprise: state => state.counter.count >= 5
})

also I noticed that we need to actually inject the store into the Vue object, which doesn't appear to be necessary in normal vuejs so you might want to highlight what is happening there and why

Vue.prototype.$store = store;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions