mdartic / vue-reactive-store

A VueX alternative : declarative + reactive + centralized way to structure your data store. Inspired by VueX and Vue.js . Compatible with vue-devtools.
MIT License
28 stars 2 forks source link

Add the fact that you must pass the whole store.state in the component data #11

Closed jrmi closed 4 years ago

jrmi commented 5 years ago

In the Readme, it took time for me to realize that i mustn't use a store.state.property in my component data but the global store.state object.

Don't

import store from '../store'

export default {
  data: {
    myStoreProperty: store.state.myStoreProperty
  },
  …
}

Do:

import store from '../store'

export default {
  data: {
    state: store.state
  }, 
 …
}
mdartic commented 5 years ago

Yup, you're right.

I think it's a limitation of Vue's reactivity system.

I'll update the README to be explicit on this case.

mdartic commented 4 years ago

Please check https://github.com/mdartic/vue-reactive-store/pull/15 and tell me if it's ok to you.

mdartic commented 4 years ago

Well, in fact I'm going to merge because I have to push a new version of the package.

mdartic commented 4 years ago

If it's ok for you, please close the issue.

jrmi commented 4 years ago

Fine for me.