DEV Community

loading...

Discussion on: Vue or React?

Collapse
michi profile image
Michael Z • Edited

most importantly it gets better first. So they come up with new things like Suspense, Server-Components recently or back in the day hooks, so no matter what they do everyone will just copy them but if you use React you get the cool things first.

Not sure how getting things first is a benefit in any way other than "being first". The first iteration of something is usually still somewhat underdeveloped. The react team itself said that useEffect is more of a low-level API, yet it's used like crazy. By not being first, you can learn from these constraints, just take a look at the list of benefits Vue's composition API has over React hooks: composition-api.vuejs.org/#compari...

Most important is React components are far more flexible

Would love to see an actual example of this as I see many pointing this out without providing anything concrete.

you write just JavaScript so no v-if stuff that forces you just to unlearn JS, In React you write If else for conditional rendering and it makes just more sense

So the first time you did react is was completely obvious that to render a list, you have to use {array.map()} in JSX? Then how come this stackoverflow question has over 144k views?

You don't unlearn JS by learning a little template language :D It's just HTML with a little reactivity sprinkled on top. In fact, Vue stays true to the traditional form of web development (HTML, javascript, CSS) at the component level rather than mixing those things left and right. (I am not saying React's approach is bad, just responding to the "unlearn JS" claim.)

also you can pass everything as props in React which is very powerful even other React components

I have no real preference here. It's nice that react allows this, keeps it simple, but I also like the structure that Vue components have thanks to this (slots > render props). But I can see how this can turn people off coming from React.

However, you have to be very careful in react to properly use useMemo and useCallback otherwise the performance of your app will be really bad on complex pages. This I find extremely unfortunate as it goes against best practices of basic API design (blog.codinghorror.com/falling-into...)

In Vue you need to duplicate yourself so often because you need to register components before using it which is crazy

That's definitely annoying, but there is an RFC to address it already.
But not nearly as bad as all the boilerplate people brought into the world by applying every possible redux abstraction they could find on npm ;)