2 ms·
I started a project in Vue and strongly regret it. At some point I would like to switch to React. The biggest reason is that React works properly with Typescri
by IshKebab 7y ago
I started a project in Vue and strongly regret it. At some point I would like to switch to React.
The biggest reason is that React works properly with Typescript. Vue can't type check anything in your templates, you can't type check Vuex (its state management system), you can't type check injected dependencies. Everything is strings. This means you'll spend a lot more time chasing down runtime errors and writing tests than with React. A lot more time.
Other differences:
* React doesn't have events, but frankly you should not use them in Vue either - use callbacks instead.
* CSS has to go in a separate file in React. That is a little annoying to be honest.
* React has an API split between traditional class-based components and function-based components ("Hooks"). They say to use Hooks in new code but I've seen some things that are really awkward to do with Hooks. Still you can just use class-based components if you like (same as with Vue).
* The React NPM package has something like 5 dependencies. Vue has something like 1000. It's basically impossible to avoid the NPM insanity if you use Vue.
* React has better documentation. Not that Vue's is bad, it's just not as extensive as React's.
* React is way more popular. Easier to hire people to work on it, bigger community to get help from etc.
* React has better tool support. Everything supports JSX/TSX. Not many things support .vue files. For example if you define a type in a .vue file you can't actually import it from any other Typescript files. Quite annoying.
There are probably other things I've forgotten. If you're using the class-based React approach then yeah they are quite similar; React is just much better engineered. If you are using React Hooks then it is quite a different approach to Vue.