DEV Community

Pedro Velazquez
Pedro Velazquez

Posted on

Vue over React just for the syntaxis? :(

Hi there. I really like these two workhorse of all frontend developers. Personally, i prefer react. I have a friend that told me he select vue all times because vue allow to "separate" your html, css and js code in a more clean way that react does... i think Yeah, maybe... but that can't be the reason to discard react and all his power... We must fell confortables with ours frameworks and coding should be pleasent, but i think that the beauty isn't only what you may see while reading code but also the hardwork performed by the library or framework and the ways you can customize it's behavior. What do you think?
PD: Excuse me if i make a mistake when writting the post. I am learning English :)

Top comments (20)

Collapse
 
yellow1912 profile image
yellow1912

So what are you trying to ask? If you feel comfortable with react, use it. If your friend likes vue, let him use it. I don't think anyone should be forced to use things he/she does not feel comfortable with.

I personally do like vue for the same reason. Plus I work with legacy system so it's kind of the only choice I have (html is generated separately by server).

Collapse
 
pedrovelborr profile image
Pedro Velazquez

No no. It's not about feel confortable with a framework (of course all of us should feel good coding in the framework that we use to develop). My point is that just for see the html outside of the javascript in the same file couldn't be the MAJOR reason for select a tool. That is what i mean

Collapse
 
yellow1912 profile image
yellow1912

Actually it can be. It was the major reason why I went with angular 1 and later with vue 2. People coming from backend background love seeing separation of concerns (css, html, js). I just cannot stand seeing all those code mixed together in a single file.

Collapse
 
leob profile image
leob

What is the "power" of React which Vue doesn't possess? I think Vue is a lot easier to use (it's doing a lot more for the dev - taking care of more things).

Collapse
 
pedrovelborr profile image
Pedro Velazquez

I like react and vue, a litle more react. My point is that there are developers who hate react because html is written inside render method, and only for that reason they choose vue... i think that is not a strong decision to choice between frameworks :(

Collapse
 
cyberhck profile image
Nishchal Gautam

That's not necessarily a good thing, react scales with number of developers very well, when number of people you work with are huge, typescript is a must also react for some reason has BETTER typescript support than vue. Our company listed some requirements and gave them weight, when compared with angular, vue and react, react took the lead

Collapse
 
leob profile image
leob

Point taken, there are a lot more devs who know React and are proficient with it, the ecosystem and community are a lot bigger, and React promotes a number of good techniques and habits (e.g. immutable state). So yes many good reasons to go with it.

But if you ask me which framework makes it EASIER for the dev (in terms of learning it, getting something working, "batteries included" etc) then I could very well make the argument that that would be Vue.

Thread Thread
 
cyberhck profile image
Nishchal Gautam

Of course no doubt about it, if someone doesn't know react nor vue, vue just might be easier to learn, but again it depends on user's background.

If he's a frontend developer, vue is easy to setup, you don't need a build tool, nothing, you can directly start using vue.

But if the developer is more comfortable with typed language, or he knows some javascript but he has more typed language background, then I still make case for React. Say whatever you will, even though vuejs has been written completely in TypeScript, the TypeScript experience is nowhere near React's standard.

With React, you do need to learn React's ecosystem, but developer doesn't need to learn a syntax for rendering a list of users (the v:for thing), with 100% TypeScript coverage, developer gets most help directly by using an IDE.

The thing I hated when I tried using Vue + TypeScript is the lack of TypeScript intellisense, so there was a prop definition and usage in a component, I try to Ctrl + Click on that prop to see how it's being used, how do I pass that, is there any other usage? It doesn't find it!

And when calling Vuex, you call mutation like this:

commit("increment")
Enter fullscreen mode Exit fullscreen mode

The string increment is just a field in your mutation, but why did it have to be stringly typed? I hate strings.

Yes vue makes it easy to write code, if that's what you need great! Vue away, but I'm not looking only for writing code, for me reading, modifying, maintaining and ability for 1000s of other developers being able to navigate through the code base is more important than writing, so I'd rather create reducer, write action creators and ensure everything has types, and deal with a little boilerplate.

Again, for smaller companies and personal projects, you don't need that, I just have a requirement where I don't want to remember anything about the framework, my IDE helps me at every step :)

Thread Thread
 
leob profile image
leob • Edited

Got it, I totally see your point, good argumentation especially when it comes to Typescript support.

TBH I have limited experience with TS, and that was only within ... React :-) ... I don't have any experience with TS in Vue so I'm totally blank there, I trust 100% what you say.

Just for the record, I'm not a Vue fanboy or whatever (I'm not a fanboy of anything because it goes against my principles), I've worked with both React and Vue, I was just pointing out a few things about Vue which you MIGHT see as a pro (but also as a con, depending on how you look at it).

P.S. I just came across this article on dev.to:
dev.to/nomoredeps/why-react-uses-i...

and I agree with the author - the way React does it (JSX) is conceptually WAY more elegant than Vue with its "special" template tags.

Thread Thread
 
cyberhck profile image
Nishchal Gautam

Thanks for the article, that says exactly what I mean, but never was able to explain in simple terms.

Collapse
 
manuelmartindev profile image
ManuelMartinDev

One thing I really like about Vue is the State Management, Vuex is a lot easier to understand than something like Redux in React, I also like the scoped styles, even so I use React , because it works, I'm comfortable with it and it gives me what I need so I didn't see the necessity of change, but it is true that the developers including me are like a kid with a new toy when a new framework shows up, so I think Vue is kind of trendy now, I have planned to do some day soon the exact same project with React and Vue, at the end of the day what matters is that the Framework make our life easier, if it does is good

Collapse
 
cyberhck profile image
Nishchal Gautam

Vuex is the reason I hated vue, you have mutation, when you call, you pass its name, I hate string being passed, when you like typed languages, you prefer typescript, and vuex using string was it for me.

With redux, 100% of my code is typed and checked on build time.

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.

Collapse
 
cyberhck profile image
Nishchal Gautam

If you're writing react and view layer isn't separate from business layer, you're doing it wrong.

You can have preference for sure, but separation of concern is wrong point, because you do it in both, just write correct react man.

I see very often people write shitty code to write quickly, but never they think that we read more code than we write, we should optimize for reading than writing, write code slower, it's okay, just make sure it's maintainable

Collapse
 
pedrovelborr profile image
Pedro Velazquez

No no. It's not about clean code or layers. It's about some people who argue that /.vue$/ files are more pleasent to read and write that react. It's like you like tabs with 4 spaces and if your new editos has tabs with 2 spaces, then you delete it :(

Collapse
 
cyberhck profile image
Nishchal Gautam

Of course, for some people it's easier to read vue files, no doubt about it. And I'm not arguing over that.

What I meant was if someone wrote a mess of a component, that's not a good reason to steer away from React, you can certainly opt for vue because you like their syntaxes.

But code quality is good in both frameworks, I wish people stop writing shitty code in the first place, people try to finish a feature fast, that's just wrong, optimize for read, maintain and modify, don't optimize for writing a feature.

Collapse
 
vonheikemen profile image
Heiker

Choosing Vue just because of syntax makes sense. Think about it this way: how many times a "React developer" has said they don't use Vue because they don't like templates?

In my opinion Vue isn't any less "powerful" than React. Both frameworks are based on components, they have a healthy ecosystem. Choosing one over the other just because of one detail is perfectly fine.