3 ms·
You may know this already, but using Vue Dev Tools you can easily export & import Vuex state.
by dabernathy89 9y ago
You may know this already, but using Vue Dev Tools you can easily export & import Vuex state.
- mythz 9y agoIt will never be as easy as Redux where the entire state is maintained in an immutable and naturally serializable plain JavaScript object in which all messages can be inspected, serialized, dehydrated, sent over the network, etc with every App state transition being easily captured / replayed or reverted to any period of time. You can force it with other state management libraries with additional machinery, but Redux's approach of sending plain JS object messages to create immutable states is naturally well suited for the task.
- dabernathy89 9y agoI'm sure they operate differently under the hood (and that's a bit of a black box for me), but as an end-user I can do any of those things with Vuex as well - time traveling, serializing state, subscribing to state mutations, etc. Doesn't require Dev Tools either, although obviously that's much more user-friendly.
- mythz 9y agoLike I said it's possible but requires additional effort and machinery, with Redux your App already constructs and dispatches state transition instructions/delta messages and renders the plain state object as a first-class construct, whereas other state management libraries need to create foreign artificial constructs to support it.
- dabernathy89 9y agoPerhaps I'm missing something. Vuex state is almost a plain JavaScript object but with Vue's getters/setters on it. I can access the root state object easily with `store.subscribe((mutation, state) => {}`. Mutations feel nearly identical to reducers (but simpler!) and interact with the state as a plain JS object. What `foreign artificial constructs` are we talking about here? EDIT: I assumed Vuex state was immutable outside of mutations, but that's only true with 'strict' mode enabled.