Live data from Hacker News

Vue 3.2

blog.vuejs.org

41–50 of 153 posts

Re: Vue 3.2

#41

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

I moved to Vue from ~3 years of React. I've now done ~2 years of VueJS while continuing to use React in some side projects.

To be quite honest, I'd probably stick with React if given the choice. My takeaway with Vue is it makes a number of choices for you out of the gate w.r.t to things like data store (Vuex) and routing (Vue-router) whereas with React you'd bolt these on yourself (i.e. mobx and found-router).

I also feel like Vue gives you many more opportunities to shoot yourself in the foot in weird and wonderful ways. For example, you can access the instance of a parent or child component without too much trouble whereas React does seem to go out of its way to prevent this.

React has a few quality of life improvements too, things like hooks (which may be in Vue now? Not sure) and being able to have components with multiple children at the root.

Re: Vue 3.2

#42

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

I've used both extensively and what makes me lean towards Vue on new projects is the reactivity system. It seems that with React you always have to wrestle with it to not do too many re-renders, but Vue is more likely to update only the parts of the dom that need updating out of the box.

With composition API and Vue 3 bringing typescript support and hooks to me it's a no brainer to choose Vue.

One other thing is that I've seen people who are normally doing only backend pick up Vue in a day or 2, but React takes longer to grok. You're probably likely to find more people who have already learned React than Vue though, due to its popularity.

React also has a bigger community but I haven't felt that I was lacking when looking for Vue libraries.

Re: Vue 3.2

#43

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

All Javascript UI frameworks are the same. They provide a way to build UI and interactivity using components, and are powered by the same functional flow of data -> render components -> trigger event -> change data -> repeat...

Once you get past the fundamentals, it's just choosing the features that you like better. Vue uses HTML-based templates by default which I find better for 99% of scenarios, and can also be generated by a server-side framework which makes it easy to integrate into existing webapps without rebuilding as a complete SPA.

Reactivity is another thing that all frameworks and state management as evolved to, since it's just automating what you were manually doing anyway. Mobx and the like were early versions but the composition API in Vue 3 is probably the most polished version of this with automatic tracking that does what you expect and intuitive effects/watchers.

Vue also has official projects vs the 'unofficial' official ones for React, but that's a purely subjective preference at this point.

Re: Vue 3.2

#44

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

I recently started working with Solid [1], it's like Svelte for React, and it's way faster than both of them. It has the same JSX syntax and very similar hooks to React. The only problem is that you will find yourself porting many React libraries since Solid is quite new and doesn't have as a big of a community.

[1]: https://www.solidjs.com/

Re: Vue 3.2

#45

Earlier quoted context omitted.

I tried vue3 and all the associated stuff like vuex and the router last month. Vuex especially has extremely poor support even if it is written in TS. I believe the next version will have better support for TS. Just writing vue wasn't much of an issue but there's not enough support for it in the templates. I believe there's VSCode extensions that help

Vuex with proper TS support would be really key as the domain model is often in the store. Now that the Vuex release has been behind Vue3 for a while is there any alternative to Vuex?

https://github.com/posva/pinia. Vue community feedback is very positive (I haven't personal experience yet)

Re: Vue 3.2

#46
post #4

I just started cobbling together a demo jquery app mess into a vue3 app yesterday, and lemme tell ya, the docs are great, and I even got from 0 to VueX in few hours today. I'm impressed. Great work Vue team. I'm normally hesitant to adopt a new version of a library when learning and expected to get bitten by a few more things but so far seems mature, stable, and well done. Edit: That said, I'm still personally not in…

.Vue file is just a .HTML file.

The and tag default to Javascript and CSS languages in HTML but Vue's compiler allows you to use other languages like Typescript or Sass automatically (assuming you have the dependencies installed). You can also similarly have the code inline between the tags or point to a separate external file with the src="..." attribute.

Re: Vue 3.2

#47

I think my favourite thing about Vue 3 and the composition API is that VueX is essentially obsolete - you can manage your global state by calling real life functions. This means instead of doing `dispatch("action")` you just call `action()`. When using Typescript this is a godsend, as the action functions keep all of their type information.

I recently found Pinia[1] as replacement for vuex.

- full typing

- real life functions

- vue dev plugin support in store section

- mutations don't exist as separate idea

- also has api, so i wrote little plugin for state synchronization with local storage.

*Typography fix

1. https://pinia.esm.dev/

Re: Vue 3.2

#48

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

I moved to Vue from ~3 years of React. I've now done ~2 years of VueJS while continuing to use React in some side projects. To be quite honest, I'd probably stick with React if given the choice. My takeaway with Vue is it makes a number of choices for you out of the gate w.r.t to things like data store (Vuex) and routing (Vue-router) whereas with React you'd bolt these on yourself (i.e. mobx and found-router). I also…

If you've only worked with vue2, I'd give vue3 a look. I like the new composition API a lot.

> you can access the instance of a parent or child component without too much trouble

$children was removed in vue3 https://v3.vuejs.org/guide/migration/children.html

> things like hooks

Vue doesn't have react style hooks, but the composition API fills a similar niche.

> being able to have components with multiple children at the root.

Vue3 seems to support this: https://v3.vuejs.org/guide/migration/fragments.html

Re: Vue 3.2

#49

Anyone moved from React to Vue. I've been reading the Vue docs and I like some things about it but the compositional model seems a bit more confusing compared to React. Also, I think I do prefer working with JSX versus using html templates. I prefer that close coupling of JS logic and JSX presentation. The most appealing thing about Vue is that it seems to be more of a framework, maybe somewhere in the middle between…

> Anyone moved from React to Vue

I'm considering a move in the opposite direction for a few reasons:

1. React Native. I can build mobile apps using Vue via Ionic Framework / Cordova / Capacitor but that ecosystem is a nightmare (esp the Cordova/Capacitor split). React Native has more extensions available and the camera related ones are considerably more featureful.

2. Libraries/widgets. Vue has widget libraries available and (multi)select fields et al work great. But when you want something more advanced - a decent calendar picker for example - I always turn up a React library that does what I want, and the Vue one doesn't. [I suspect there's compatibility issues if you use too many React widgets - gras is always greener etc]

3. Expectation that you know React. I've had clients say "we use Vue, do you know it?" but I've had 10x more say "We use React, do you know it?".

Re: Vue 3.2

#50
post #20
post #7

Earlier quoted context omitted.

Larger community and higher adoption rate among companies. If you run into a weird issue you’re more likely to find someone who’s had the same issue and solved it. There are plenty of established best practices and patterns to follow. Good learning materials and documentation. More supporting packages and libraries - usually people build for both React and Vue, it’s rarer to see Svelte.

I've used both professionally (and React as well). I can't stand Vue (but haven't tried newer versions). The reason is that Vue is miserable to debug in the browser. It is really clever to use proxies for values but then you have to make an extra click to see the actual value and it really slows you down. Recreating the state of the app inside your head can't be done quickly because you have to manually evaluate ever…

> "Svelte is just JavaScript"

All JS frameworks are just Javascript. What else would they be? The templates however are all specific DSLs, whether it's JSX, HTML with directives, or Svelte's own syntax. In the end these template just get compiled into a JS render function that takes in data and returns an HTML structure.

Post reply on HN