marina-mosti/vue-refresh-proofing-demo

Use $set() to update your form data

Closed this issue · 1 comments

Hi Marina,
your article is very interesting, but according to me you should change the way you update your form properties into the updateForm() method.

To let Vue reactivity work best, you should use the $set() method, instead of updating the object properties directly. This will make your code much more solid.

So I suggest to fix the method this way:

 updateForm (input, value) {
     // Not this: 
     // this.form[input] = value
     // instead do this:
     this.$set(this.form, input, value);
     ...

I forgot to tell that I'm here after reading this article: https://www.vuemastery.com/blog/Refresh-Proof-Vue-Forms-with-Local-Storage/