DEV Community

Discussion on: Vue over React just for the syntaxis? :(

Collapse
 
vonheikemen profile image
Heiker

I'm going to leave this right here just in case someone finds it useful:
Mutations - Object-Style Commit

Thread Thread
 
cyberhck profile image
Nishchal Gautam

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.

Thread Thread
 
vonheikemen profile image
Heiker

Interesting.

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?

Thread Thread
 
cyberhck profile image
Nishchal Gautam • Edited

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.