Neither ReactJS or VueJS are overly novel anymore. With lots of time to establish identities, can we have a discussion about what fundamentally differentiates these popular JavaScript approaches?
Feel free to debate, but keep it respectful. ๐
Neither ReactJS or VueJS are overly novel anymore. With lots of time to establish identities, can we have a discussion about what fundamentally differentiates these popular JavaScript approaches?
Feel free to debate, but keep it respectful. ๐
For further actions, you may consider blocking this person and/or reporting abuse
Manish Kumar Sundriyal -
bhattji007 -
Chris Siku -
Chris Siku -
Top comments (46)
Here's my take on it:
React
Vue
I think react is opinionated. (Jsx and redux, top down data passing, hooks) However it doesn't hijack JavaScript.
I do see that differently:
JSX is sugar over basic JS, it compiles to produce a javascript function that is fast to run. "v-for=" is not. It's being interpreted at run time I believe (feel free to correct me on that, not a Vue expert, tried it for a prototype and felt it was too "other").
I certainly use Hooks (it's a method) but not Redux (don't like it). I use hooks to do lower down binding and reinterpretation of refreshes, because that's my style and it works for me. So I guess React might have an opinion but is isn't forcing it on me :)
First time I saw Jsx I thought it was the coolest thing since chewing gum! I like it actually.
Hooks tie into their state stuff, I don't like react's state stuff. Why? Because I don't see the advantage of farming off state to another thing. Internal variables to the component or even observables are closer to the metal in my opinion. In fact, an Observable could easily mimic the React state stuff. Right?
Yeah it's the diffing/refreshing algorithm. See I don't farm it off much - only perhaps when it's a local thing that isn't part of the real application state. So imagine my app is editing documents, I'd use useState to capture the rename of something, in a dialog, in case the user cancels. The rest of the time my React looks like this:
Those BoundXYZ things come from a neat little wrapper that interprets the specific components value and events - a one liner
for all of the MaterialUI components I use and the ability to return to
the core if I need it.
Refresh up there is basically an internal trigger using a useState() hook to trigger rendering and perform other actions.
What's your thoughts on this? I haven't tried it in React , but this is how I do it in Angular. Angular automatically detects changes to bound elements.
Yeah I've always liked Angular. We didn't choose it for our current project because we found it hard to "late load" unknown classes for injection into a template - which is a very specific requirement.
If I were to put the point for React it would be that its fairly explicit about what it's doing - it's very mechanical and low level - though having looked at an article of Fiber recently - I guess it isn't THAT low level.
I need something to feel like bound data to be happy, so I make my own. I dislike Redux because your logic is in a huge pile somewhere else. That never worked for the way I reason out problems.
Redux is not part of React, and is not even recommended in the website, neither it's recommended by the team.
But yeah, React has some opinions on how to build UIs, that includes how to define the UI (JSX) and how to control the state of your UI (top down data passing, useState/useReducer) and how to run effects. Nevertheless, aside of that it's completely un opinionated, it doesn't care how you style your components, how you fetch data, how you manager routes, not even how you animate, that is why there are libs for those things instead of being part of React itself.
When I first learned the top down data model and state stuff, I didn't like react. Then I found they altered Css and renamed tags like link.
What do you mean by "they altered CSS"?
Instead of this:
When I first read about this many years ago I did not like it. I didn't understand it at the time.
I'd say that's "altered HTML" (JSX), but no CSS has been altered, right?
I love Vue, it has a special place in my heart since I was weaned on KnockoutJS and MVVM. Data bind syntax in dom nodes make a lot of sense to me.
I've done more professional react dev over the past 3 yrs, but I can say they both offer very similar or identical features.
React is very FB, and Vue is very OSS, but it's worth pointing out that both ecosystems have a healthy amount of corporate sponsorship and OSS activity.
Vue pushes the single file component paradigm a lot, but you dont have to do it. React pushes the hook based state management, but you don't have to do it.
In conclusion, they are identical twin brothers who grew up in different countries. Who you will want to date or marry largely depends on your first date experience.
The biggest difference to me is the decisive opinions on state and routing that Vue made and React did not.
With Vuex and Vue router, there is an expected bundling of tools for creating a Vue app. This makes it more approachable for beginners.
React is incredibly configurable, but that can be intimidating for those that aren't comfortable architecting a full frontend application.
I'll also add that I'm a big fan of the breakdown of a Vue component. They took the angular style of 3 files and collapsed it into one. Data, display, styles.
React, again, is much more open to interpretation on best practices in component structure.
A lot can be written here but I will just mention the model binding feature that VueJs and Angular offer that make life easier.
Personal feeling, VueJs contains the best features of the two worlds (Angular and React).
I use both React and Vue. Here are my thoughts:
When I build prototypes, I like to use Vue.
When I prototype, I use Vue without any build tooling (no vue-cli, no webpack, no dev server; just an HTML file; double-click, open, edit, refresh). I made a single-file template for me to kickstart new projects with it.
babel-standalone
, but it doesnโt work with<script src="...">
infile:///
URLs without disabling web security in Chrome. htm also exists that lets me create virtual DOM nodes with tagged template literals, but my code wouldnโt be in normal JSX syntax anymore. I also tried hyperscript before. Having different syntaxes to represent the virtual DOM in different React projects added a lot of mental load. When I use React I prefer JSX and nothing else.I find Vueโs reactivity system and its two-way bindings for forms (
v-model
) made me very productive. I just change the object (this.loading = true
) and the UI updates. No need touseState
and do all the data-binding ceremony.useObserver
(hooks),<Observer>
(render props) orobserver
(HOC) to make the component reactive. Itโs not built in.Vue comes with a
:class
helper, which turns arrays and objects into a class string. e.g.:class="[ running ? 'bg-green-400' : 'bg-red-400', { 'opacity-50': disabled }]"
className
strings by myself or use a third-party library such asclassnames
. Itโs not built in.Vue has enter and exit transitions as well as move animations (implementing the FLIP technique) built-in.
However, if Iโm creating a project that I intend to maintain long-term, I would use React.
It has a first-class support by TypeScript (
"jsx": "react"
). The JavaScript and TypeScript Language Service allows me to do large-scale automated refactoring. For example, in VS Code, I can rename a componentโs prop, letโs say fromtitle
(a very common name) topageTitle
, and the editor would find every file that uses this component and automatically renames it. (Video demonstration)title
) or manual refactoring (can be more time-consuming).React components can return just text (no wrapping nodes), as well as multiple nodes (
React.Fragment
).<template>
as component root element because it may contain multiple nodes.โ React supports this since 2017. For now, in Vue, we have to use a 3rd party library like vue-fragment. I heard that Vue 3 will support this and I am really looking forward to it.Vue 3 will fix all your qualms with v2 and should be entering Beta relatively soon. It has first class TS support (it's written in TS), fragments, portals, suspense, hooks and is smaller and faster๐
Thanks for your comment, Iโm looking forward to it! ๐คฉ
Regarding tooling, will I be able to rename a prop and have that rename propagate throughout my source tree when v3 comes out?
I consider this an absolute must before I can consider using it in serious projects because I do a lot of small refactoring.
Sometimes I name variables/props
x
/foo
/tmp
and rename it later when I have the main logic figured out, where I can actually be more thoughtful about naming thingsโฆ and I donโt want to do that renaming manually.To be honest, I have no idea. I don't generally rename props. I don't see an issue if you're using JSX for templating, but using the template syntax, I'm not sure. You can download the alpha and try ;)
Love your starter template! That was very similar to one I used (except with routing). I recently changed to http-vue-loader so I can write my templates in external files.
I started with React and used it a lot. I was super hesitant to start using Vue but my new job required it. After about a month of Vue I liked it as much as React. After 3 I liked it more than React and started to deep dive into it. Single file components made a lot more sense to me, the ability to build functional components instead, when appropriate, was great, and the whole Dev process was just nicer. I've been using Vue for almost 3 years now I and I don't miss React at all. Just looking at files in React vs Vue make me love Vue even more.
As a bonus, it's super easy to inject Vue components into a Rails view. I normally use Stimulus if I'm working on a Rails project but if I need JS super powers being able to inject a Vue component easily is awesome.
Vuejs is fast and easy to learn but for react you need more experience with javascript about ES6 syntax but you can do more things with react btw i still react developer and I am enjoying it also .drop your thoughts below ๐ฝ have a good day!
I believe it is crucial that for whatever JavaScript framework you want to use, you get a good grasp of JavaScript first. (This includes ES6+, which I consider part of JavaScript).
You can do all the things with Vue that you can also do with React. The biggest difference is the way you code and the way it works internally. Both Vue and React can be used for large-scale apps.
I would even make the point that Vue is more versatile because it can easily be included in legacy code while React doesn't give that option.
In the end, it all depends on personal preference. Whether you like React, Vue, Angular, Ember, Svelte, etc... The most important part is that you feel comfortable with the framework or library you choose.
My personal preference is Vue, because I find it way more elegant than React.
No svelte.dev love? ๐
Secret svelte devs unite! ๐
I just leave this here โบ๏ธ
I had an option to choose when my previous company was paying for a course, I had a react course already purchased but vue kept popping up in my social. I tried both and ended up choosing vue because it was just more readable and I was able explain my frontend code even to my Team lead who is a traditional python dev and now I work as a professional vue dev and I can say I am pretty happy with my descision of moving ahead with it.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.