You didn't understand what I meant, of course, it's not that, did you notice inside the object, there's a field called "type", the value for which is a string "increment" it's the name of the method inside your mutation, that's my point.
As far as I know redux uses a similar convention. When you call dispatch you must pass an object with a type property. That type property doesn't have to be a string but it is strongly recommended that you make it a string. Why would it be such an inconvenience in vuex? Is it really because they are methods?
What happens when you call a mutation which doesn't exists? With redux it's that way because by default you return current state, and if I'm writing with typescript, I can even get typescript on those stringy values (just need to write types correctly). With vuex, if they had something like: commit(mutation.increment) that'd be much better.
That's the biggest reason I switched back from vue to react, close but second biggest reason is lack of similar level of typescript support. Because of templates, for some reason vue has less typescript coverage (similar to angular)
You can compare all 3 projects, even though react internally isn't written in typescript (yet), it has the best typescript support.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You didn't understand what I meant, of course, it's not that, did you notice inside the object, there's a field called "type", the value for which is a string "increment" it's the name of the method inside your mutation, that's my point.
Interesting.
As far as I know redux uses a similar convention. When you call
dispatch
you must pass an object with atype
property. Thattype
property doesn't have to be a string but it is strongly recommended that you make it a string. Why would it be such an inconvenience in vuex? Is it really because they are methods?What happens when you call a mutation which doesn't exists? With redux it's that way because by default you return current state, and if I'm writing with typescript, I can even get typescript on those stringy values (just need to write types correctly). With vuex, if they had something like: commit(mutation.increment) that'd be much better.
That's the biggest reason I switched back from vue to react, close but second biggest reason is lack of similar level of typescript support. Because of templates, for some reason vue has less typescript coverage (similar to angular)
You can compare all 3 projects, even though react internally isn't written in typescript (yet), it has the best typescript support.