DEV Community


Discussion on: Watch for Vuex State changes!

eladc profile image
Elad Cohen

Why you use Vue.set(state, 'status', status) instead of just state.status = status?

viniciuskneves profile image
Vinicius Kiatkoski Neves Author

In this case it is not necessary and I could have use state.status = status, no worries.

But as I'm more concerned with ( I've got used to always write Vue.set to avoid any pitfalls while developing. So it is just a way to keep the codebase concise (in one mutation it is state.prop = prop and in the other is Vue.set...).