{"action":"created","issue":{"url":"https://api.github.com/repos/vuejs/vue/issues/2129","labels_url":"https://api.github.com/repos/vuejs/vue/issues/2129/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue/issues/2129/comments","events_url":"https://api.github.com/repos/vuejs/vue/issues/2129/events","html_url":"https://github.com/vuejs/vue/issues/2129","id":125587235,"number":2129,"title":"State managment in components","user":{"login":"erguotou520","id":7945757,"avatar_url":"https://avatars.githubusercontent.com/u/7945757?v=3","gravatar_id":"","url":"https://api.github.com/users/erguotou520","html_url":"https://github.com/erguotou520","followers_url":"https://api.github.com/users/erguotou520/followers","following_url":"https://api.github.com/users/erguotou520/following{/other_user}","gists_url":"https://api.github.com/users/erguotou520/gists{/gist_id}","starred_url":"https://api.github.com/users/erguotou520/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erguotou520/subscriptions","organizations_url":"https://api.github.com/users/erguotou520/orgs","repos_url":"https://api.github.com/users/erguotou520/repos","events_url":"https://api.github.com/users/erguotou520/events{/privacy}","received_events_url":"https://api.github.com/users/erguotou520/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-08T10:51:56Z","updated_at":"2016-01-08T11:00:51Z","closed_at":null,"body":"I try to use store module in my project, the store looks like:\r\n```js\r\nmodule.exports = {\r\n  state: {\r\n    login: false\r\n  },\r\n  setLoginState: function(login) {\r\n    this.state.login = login;\r\n  }\r\n};\r\n```\r\nAnd my component code looks like:\r\n```js\r\nVue.component('some-component', {\r\n    template: require('./some-component.html'),\r\n    data: function() {\r\n      return {\r\n        isLoggedIn: store.state.login\r\n      };\r\n    }\r\n  });\r\n```\r\nBut I found that whatever I changed `store.state.login` to, the `isLoggedIn` always return false(the default value). Then, how to fix it?"},"comment":{"url":"https://api.github.com/repos/vuejs/vue/issues/comments/169964163","html_url":"https://github.com/vuejs/vue/issues/2129#issuecomment-169964163","issue_url":"https://api.github.com/repos/vuejs/vue/issues/2129","id":169964163,"user":{"login":"Nirazul","id":781476,"avatar_url":"https://avatars.githubusercontent.com/u/781476?v=3","gravatar_id":"","url":"https://api.github.com/users/Nirazul","html_url":"https://github.com/Nirazul","followers_url":"https://api.github.com/users/Nirazul/followers","following_url":"https://api.github.com/users/Nirazul/following{/other_user}","gists_url":"https://api.github.com/users/Nirazul/gists{/gist_id}","starred_url":"https://api.github.com/users/Nirazul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nirazul/subscriptions","organizations_url":"https://api.github.com/users/Nirazul/orgs","repos_url":"https://api.github.com/users/Nirazul/repos","events_url":"https://api.github.com/users/Nirazul/events{/privacy}","received_events_url":"https://api.github.com/users/Nirazul/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T11:00:51Z","updated_at":"2016-01-08T11:00:51Z","body":"You are setting `isLoggedIn` to the value contained in `store.state.login`. This value is copied, not referenced. It should work, when you change it to an object reference:\r\n\r\n```\r\nVue.component('some-component', {\r\n  template: require('./some-component.html'),\r\n  data: function() {\r\n    return {\r\n      state: store.state\r\n    };\r\n  }\r\n});\r\n```\r\n\r\nand then change it like this:\r\n\r\n```\r\nthis.state.login = true;\r\n```"}}