DEV Community

Cover image for Design Patterns: Vue feels like React - TypeScript 🔥

Design Patterns: Vue feels like React - TypeScript 🔥

Natserract on November 30, 2019

Cover photo by Ricardo Gomez Angel on Unsplash. When you first want to learn about a front-end technology, you will be confused by the many choice...
Collapse
 
intermundos profile image
intermundos • Edited

See no added benefit in working with Vue as react. If you like jsx and React way, use React. Why bother with all this, especially when there is no certain way to prove that this setup will work flawless. IMHO

Collapse
 
natserract profile image
Natserract

Haha, you didn't read my full article correctly, this is the react pattern implementation in vue, how do react developers understand the vue with the same pattern. If you do not want to bother, you can sit and be quiet, then notice how javascript is very flexible in almost everything, you can use any method in your development process

Collapse
 
intermundos profile image
intermundos

Haha, might be its me gotten your article wrong. What pattern are you talking about? Take Vue and start using it as React? You may notice that JS is perhaps very flexible but still see no reason to build another bicycle other than just for fun and to prove you can turn Vue into React. As said before - want to use React like pattern - use React. Kudos from the quiet and good luck with this abomination you build there.

Thread Thread
 
natserract profile image
Natserract

LOL, I didn't change vue to React. I just used the pattern and what i mean is flexible is not for fun. Maybe you only take one word in this article, I don't know what you mean "want to use React like pattern - use React" Haha, even for ordinary people who already know that, are you kidding?

Thread Thread
 
natserract profile image
Natserract

As I said earlier, javascript is very flexible, you can do anything. The development of technology is very fast, and as developers we must also learn the new technology (if needed). In this article I explain how we easily master these two front-end technologies with same pattern. Is there anything unclear?

Thread Thread
 
wkrueger profile image
wkrueger

"react" was mostly just a tagline.

Switching html to JSX is just a minor templating change. It's like changing from - say - HTML to pug.

If you havent used typescript you would never understand... but JSX plays VERY well together with typescript because since it is just a syntax sugar for javascript, you get excellent TS goodies (type checking, completions, tooltip docs) on templates.

Even if vue or angular templates have their own language services, its not the same thing. You wont't ever get a language service on templates as good as just TS acting over JS.

Now, on the other side, the composition api seems something a bit more controversial. But since it is mainained by vue itself, I'd trust it!

Collapse
 
fly profile image
joon

I have a feeling that this way of setting up a project could help Vue users who are trying to switch to React.(or vice versa)
Thank you for the post!

Collapse
 
meistertea profile image
MeisterTea

Who could want to switch to react after trying vue except being forced to?

Collapse
 
fly profile image
joon

I have a dev friend(whom I sent this post to) who used vue but decided to switch because of the political preferences of the Vue devs. It can be surprising what makes some people switch their tech stacks :)

Collapse
 
natserract profile image
Natserract

I choose both 😁

Collapse
 
edwinharly profile image
Edwin Harly

I've tried both and personally I prefer react

Collapse
 
fantasticsoul profile image
幻魂 • Edited

try setup(powered by concent) in react:
js ver: codesandbox.io/s/concent-guide-xvcej
ts ver: codesandbox.io/s/concent-guide-ts-...
function component and class component share business logic code easily.

Collapse
 
funksoulninja profile image
Anthony Falcon

Vue is great to work with, but the TypeScript types support is lacking when compared to React or Angular. If you're not typing your code, Vue (especially with nuxt) is very fun to work with. Though, with very large and complex applications, I believe Angular or React is the best way to have secure and robust code.

Collapse
 
willvincent profile image
Will Vincent

You could always use jsx with vue, that's not a new thing. Honestly I skimmed the article so that may not have been a point made though... anyway, just because you can doesn't mean you should. Vue's template syntax is easy to use and understand, that's a huge part of its appeal.. jsx is fugly

Collapse
 
natserract profile image
Natserract

Hmmm, finally I know, this is the reason why some developers avoid JSX, because they say it's “complicated”, “fugly”, or blabla 🤣

Collapse
 
ghalex profile image
Alexandru Ghiura

Congrats on your article. I use and love both (React & Vue).

Collapse
 
paul_melero profile image
Paul Melero
Collapse
 
wkrueger profile image
wkrueger • Edited

I haven't used vue yet, but it completely nails in so many aspects, such as providing a good default form library, good starters for zero-build projects... and this: flexible templating!