DEV Community

Discussion on: Using Vue Observable as a lightweight state management alternative to Vuex

ejwaibel profile image
Erik Waibel

With the amount of code you have to write for the getState and setState methods, it seems like a simple Vuex store would work better, no? With Vuex you could just setup your state with whatever data you want to "observe" and then you can just change it directly through a mutation, which also would enforce not touching the state directly from your component.

Based on the small documenation for Vue.observable, it seems like you would use it when you want to modify state directly and make sure your application is reactive to that change, which would make more sense for small projects that wouldn't need to use Vuex.